Boolean variable returns as string from javascript function [duplicate]

Why is it that when I'm returning, what I think is, a boolean variable from a javascript function, it is detected in the calling function as a string, but if I return a boolean literal, the calling function detects it as a boolean?

So, for example:

$( document ).ready(function(){
    $('#result').text(typeof validate());
    $('#result2').text(typeof validate2());

function validate(){
    status = true;
    status = false;
    return status;
function validate2(){
    return true;
<script src=""></script>
<div id="result"></div>
<div id="result2"></div>



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.