example of javascript code
Example 1: simple javascript code
let data = {
name:"Brendan Eich",
inventor :"Javascrpt"
}
console.log(`The name of his is ${data.name}. He is the inventor of ${inventor} programming language`);
Example 2: javascript example code
var one = 1
if (one >= 1) {
console.log("CHANGE VAR TO 0")
}
Example 3: javascript examples
// store input numbers
const num1 = parseInt(prompt('Enter the first number '));
const num2 = parseInt(prompt('Enter the second number '));
//add two numbers
const sum = num1 + num2;
// display the sum
console.log(`The sum of ${num1} and ${num2} is ${sum}`);