Forwarded from coding with ☕️
let message;
message = 'Hello!';
alert(message);
Forwarded from coding with ☕️
let name = "John";
// embed a variable
alert( `Hello, ${name}!` ); // Hello, John!
// embed an expression
alert( `the result is ${1 + 2}` ); // the result is 3
Forwarded from coding with ☕️
let name = "Ilya";
alert( `hello ${1}` ); // ?
alert( `hello ${"name"}` ); // ?
alert( `hello ${name}` ); // ?
Forwarded from coding with ☕️
let age = prompt('How old are you?', 100);
alert(`You are ${age} years old!`); // You are 100 years old!Forwarded from coding with ☕️
let isBoss = confirm("Are you the boss?");
alert( isBoss ); // true if OK is pressedForwarded from coding with ☕️
let year = prompt('In which year was the ECMAScript-2015 specification published?', '');
if (year < 2015) {
alert( 'Too early...' );
} else if (year > 2015) {
alert( 'Too late' );
} else {
alert( 'Exactly!' );
}Forwarded from coding with ☕️
Addition +,
Subtraction -,
Multiplication *,
Division /,
Remainder %,
Exponentiation **.
Forwarded from coding with ☕️
alert( 6 - '2' ); // 4, converts '2' to a number
alert( '6' / '2' ); // 3, converts both operands to numbers