let num1 = 0, num2 = 0, str1 = '';
num1 = 2;
num2 = num1 * 20;
str1 = 'hello php.cn';
console.log(num1, num2, str1);
console.log('------------------');
console.log(`${num1}`, typeof num1, `${num2}`, typeof num2, `${str1}`, typeof str1);
const STR_ADDR = 'China';
console.log(STR_ADDR, typeof STR_ADDR);
console.log('------------------');
// 函数类型1
function add(a, b) {
return a + b;
}
console.log(`${num1} add ${num2} = ` + add(num1, num2));
// 函数类型2
let add2 = function (a, b) {
return a + b * 2;
}
console.log(`${num1} add2 ${num2} = ` + add2(num1, num2));
//函数类型3
let add3 = (a, b) => {
return a + b * 3;
}
console.log(`${num1} add3 ${num2} = ` + add3(num1, num2));
//函数类型4
((a, b) => {console.log(`${num1} add4 ${num2} = ` + (num1 + num2 * 4))}) (num1, num2);
console.log('------------------');
let varBoolean = (num1 > num2);
console.log('varBoolean:'+varBoolean, typeof varBoolean);
let varStr
console.log('varStr:'+varStr, typeof varStr);
console.log(null, typeof null);
console.log('------------------');