JS Notes

Data Types in JS


We assigned data to the variable by using the assignment operator "=". Datatypes in JavaScript are:

  1. Number i.e., 11,23,45,6

  2. Strings, i.e., "Hello World."

  3. Boolean, i.e., true, false

  4. Undefined

  5. Null

  6. Any of the complex data structures (Array and Objects)



Let

Block level scope, it works under block { }

if call outer side of block the global let value will call

console.log('tut3');
// Variables in js
// var, let, const
var name = 'harry';
var channel;
var marks = 3454;
marks = 0;
channel = 'CodeWithHarry'
console.log(name, channel, marks);
// Rules for creating JavaScript Variables
/*
1. Cannot start with numbers
2. Can start with letter, numbers, _ or $
3. Are case sensitive
*/
var city = 'Delhi';
console.log(city);

const ownersName = 'Hari Ram';
// ownersName = 'Harry'; // Cannot do this (error)
console.log(ownersName);
const fruit = 'Orange';
last line

Comments

Popular posts from this blog

NS- Notes