运行结果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <script> /* 值类型 */ let a = 100; let b = a; a = 200; console.log(b); //100 //引用类型 let c = { age: 20 } let d = c; d.age = 100; console.log(c.age); //100 /* 常见值类型 */ let a //undefined const a = 'abc' const n = 100 const b = true const s = Symbol('s') const n = null; //引用类型 对象 数据也是引用类型 函数也是也是引用类型 const obj = { x: 100 }; const arr = ['a', 'b'] function fn() {} </script> </body> </html>