If I declare a JavaScript boolean variable like this:
var IsLoggedIn;
And then initialize it with either true or 1, is that safe? Or will initializing it with 1 make the variable a number?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Types are dependent to your initialization:
But take a look at this example:
Your variables’ type depends on the assigned value in JavaScript.