let num = 1;
let newNum = num++;
console.log(num);
console.log(newNum);
>>> 2
>>> 1
What really happend is:
let num = 1;
let newNum = num;
num++;
If we want newNum to equal 2:
let newNum = ++num;
Concatenating Texts with Numbers
alert("2 + 2 is " + 2 + 2);
>>> 2 + 2 is 22
When a String element and a number element are added, the number element is changed to a String data type. Make sure to use paranthesis if mathematical expression needs to be carried out before concatenation.
In Javascript, invoking any function involves an arbitrarily long list of parameters. There need be no relationship between the number of parameters passed to a function and the number declared. All parameters that weren't supplied will have the undefined value.
function foo(x, y, z){
x === 1
y === undefined
z === undefined
}
Following function declaration is possible:
function x(a, b, c) {
// ...
}
And this is also possible:
function noArgs() {
var a = arguments[0], b = arguments[1], c = arguments[2];
// ...
}
All functions return. When return keyword is ommitted, functions will return "undefined"
Any element type is allowed in an array.
4.27 수정중