In last part we learned about variables right ? Now today we are going to learn a bit more about variables.
We can’t start variable name with symbol. Like –
Variable can start with a letter than numbers, it’s fine. But no way to start numbers
But you can start a variable with _ & $
We can’t have space in variable name and if we need a long variable name. Then we use camelCase. Which means you’ll write in big letter the second word. example –
Let do a little easy trick with variable. First we’ll get two variable and add them and store it on a new variable, then we’ll see if we got the exact value
Another thing, we can change the types of variable just by storing that value on there, like –
What if we didn’t mention any type while initialing a variable. It will be undefined. This is another type of JS, we didn’t learn at first. If you never initialize a variable but trying to call it, then it will give you a reference error
Do you learn some new stuff today ?