JavaScript is one of the most popular and dynamic programming languages out there.
console.log("I love JavaScript");
console.log('JavaScript is fun');Output
I love JavaScript
JavaScript is fun
console.log(`I love JavaScript`);
console.log(`JavaScript is fun`);Output
I love JavaScript
JavaScript is fun
console.log(8);
console.log(80.5);Output
8
80.5
let language = "JavaScript";
console.log(language);Output
JavaScript
let number = 5;
console.log(number);Output
5
var name = "Jack";
console.log(name);Output
Jack
let name = "Punit"
console.log(name)
name = "James"
console.log(name)Output
Punit
James
const passportNumber = 39983;
console.log(passportNumber);Output
39983
const passportNumber = 39983;
console.log(passportNumber);
passportNumber = 44325;
console.log(passportNumber);Output
TypeError: Assignment to constant variable.
let name;
console.log(name);Output
undefined
let name = "Punit";
console.log(name);
name = undefined;
console.log(name);Output
Punit
undefined
let city = "New York";
console.log("City: " + city);Output
City: New York
let city = "New York";
console.log(`City: ${city}`);Output
City: New York
let city = "New York";
let kfcLocation = 10;
console.log("City: " + city + ", " + "KFC Locations :" + kfcLocation);Output
City: New York, KFC Locations :10
let city = "New York";
let kfcLocation = 10;
console.log(`City: ${city}, KFC Locations: ${kfcLocation}`);Output
City: New York, KFC Locations :10
Q. Which of the following is the correct variable name?
- switchNumber
- 1switchNumber
- switch number
- switch
Answer: 1