+ 2
Why zero ?
That's a code i sound of FreeCodeCamp to print out the length of a string, but why did they assign the value of "firstNameLength " to zero ? here's the code: var firstNameLength = 0; var firstName = "Ada"; firstNameLength = firstName.length;
4 Answers
+ 2
Normally you dont have to initialize variabiles in Java Script. But could be a good practice derived from languages like Java.
+ 1
That's hard to say without the context. Can you upload more of the code and link it here?
+ 1
I think it's for safety if you not define 0 it will be undefined. And it's good practise to define variables.
Hot today
SQL
1 Votes
BMI calculator code project
0 Votes
How to create a border
0 Votes
How do I delete my account?
1 Votes
please help me to solve it..
1 Votes