es6 const定义基本数据类型的变量是不可以修改,其它复杂数据类型是可以修改的

es6 const定义基本数据类型的变量是不可以修改,其它复杂数据类型是可以修改的

const arr = [1,2,3] ;
  arr[3]= "hello";
  arr.push("world")
  //arr = [1,2,"hello","world"]

猜你喜欢

转载自blog.csdn.net/qq_36416878/article/details/80542499