JavaScript is one of the 3 languages all web developers must learn:
- HTML to define the content of web pages
- CSS to specify the layout of web pages
- JavaScript to program the behavior of web pages
- Number - 1,2,3...
- String - 'Hi Yash'
- Boolean - true/ false
- Null - Explicitly set a variable with no value
- Undefined - For variables that have not yet been defined
- Object - Complex data structures - Arrays, Dates...
- Symbol - Used with objects
let result = `${title} ${names} ${message}`;
console.log(result);
let html = ` ${title}
${names}
${message}`;
console.log(html);
//Strict Comparison
let ageIs=25;
console.log(ageIs===25);
console.log(ageIs==='25');
console.log(ageIs!==25);
console.log(ageIs!=='25');
//Type Conversion
let val ='100';
console.log(typeof val);
val=Number(val);
console.log(val+1);
console.log(typeof val);
Function Declaration can be hosted
//Function Declaration
function greet(){
console.log("Hello Yashwanth");
}
Function Declaration cannot be hosted
//Function Expression
const speak =function()
{
console.log("Good Day");
};
greet();
speak();
//Arguments & Parameters
const speak =function(firstName='Yash',lastName='Yashz')
{
console.log(`Good Day ${firstName},${lastName}`);
};
speak();
speak('Yashwanth','Parameswaran');
const calcArea=function(radiusArea)
{
return 3.14 * radiusArea **2;
}
const area= calcArea(5);
console.log(area);
const calcArea=radiusArea => {
return 3.14 * radiusArea **2;
}
const area= calcArea(5);
console.log(area);
const greet = () => 'Hello, World';
greet();