examples of javascript

Example 1: javascript code

function getIntoAnArgument() {
    var args = arguments.slice();
    args.forEach(function(arg) {
        console.log(arg);
    });
}

Example 2: 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}`);

Example 3: js examples

To create a new primitive symbol, you write Symbol() with an optional string as its description:

Examples:

let sym1 = Symbol()
let sym2 = Symbol('foo')
let sym3 = Symbol('foo')

Tags:

Html Example