Variables
Data types to remeber when assigning thr Variable:
- Number: Floating point numbers, for decimals and integers
- String: Sequence of characters, used for text
- Boolean: Logical data type that can be true or false
- Undefined: Data type of a variable that does not have yet
- Undefined: Data type of a variable that does not have yet
- Null: Also means 'non-existent
Rules to choose Variable
- Names can contain letters, digits, underscores, and dollar signs
- Names must begin with a letter
- Names can also begin with $ and _ (but we will not use it in this tutorial)
- Names are case sensitive (y and Y are different variables)
- Reserved words (like JavaScript keywords) cannot be used as names
Example of Assiging Variables
var firstName = 'Roopak';
var lastName = 'Kumar';
var age = 26;
var job = 'Student'
var fullName = (firstName +' '+ lastName);
console.log('My name is ' + fullName + ' and I am ' + age + ' years old and I am a ' + job);