定义:
//一般情况
var word = "Hello World";
console.log(word);
//输出:Hello World
//变量提升?
console.log(word);
var word = "Hello World";
//输出:undefined
//变量提升!
word = "哈哈哈";
console.log(word);
var word = "Hello World";
//输出:哈哈哈
//所谓的全局变量,已经在window对象上了
var word = "Hello World";
console.log(window.word);
//输出:Hello World
//不写var
word = "Hello World";
console.log(word);
console.log(window.word);
//输出:
//Hello World
//Hello World
方法:
//一般情况
var word = "Hello World";
function PLAYFULHD() {
console.log(word);
}
PLAYFULHD();
//输出:Hello World
//变量提升?
PLAYFULHD();
var word = "Hello World";
function PLAYFULHD() {
console.log(word);
}
//输出:undefined
//变量提升?
PLAYFULHD();
function PLAYFULHD() {
console.log(word);
}
var word = "Hello World";
//输出:undefined
//变量提升!
word = "嘿嘿嘿";
PLAYFULHD();
function PLAYFULHD() {
console.log(word);
}
var word = "Hello World";
//输出:嘿嘿嘿
//不写var
word = "Hello World";
function PLAYFULHD() {
var word = "嘿嘿嘿";
console.log(word);
}
PLAYFULHD();
console.log(word);
//输出:
//嘿嘿嘿
//Hello World
重复定义:
//重复定义1
var word = "Hello World";
console.log(word);
var word = "哦吼吼";
console.log(word);
//输出:
//Hello World
//哦吼吼
//重复定义2
var word = "Hello World";
console.log(word);
function PLAYFULHD() {
var word = "哦吼吼";
//let word = "哦吼吼"; //效果一样
console.log(word);
}
PLAYFULHD();
console.log(word);
//输出:
//Hello World
//哦吼吼
//Hello World
一到三万元的小本生意 https://zhuanlan.zhihu.com/p/157978996
没人注意的暴利行业 https://zhuanlan.zhihu.com/p/157835002
月入2万的10个小生意 https://zhuanlan.zhihu.com/p/149634897
不起眼的暴利小生意 https://zhuanlan.zhihu.com/p/148417881
不起眼的暴利小生意 https://www.jianshu.com/p/4add3f83efca
一到三万元的小本生意 https://yajieju.lofter.com/post/1f7310e9_1c9df1ee2