1、var colors =['red','blue','green'];

console.log(colors.toString()); // red,blue,green

总结:toString()方法 会返回数组中每个字符串形式拼接而成的以一个逗号分开的字符串

2、var colors =['red','blue','green'];

  console.log(colors.toString()); // red,blue,green

console.log(colors.valueOf()); // ['red','blue','green']

总结:.valueOf()方法 会返回的是数组本身

3、var colors =['red','blue','green'];

  alert(colors.toString()); // red,blue,green

alert(colors.valueOf()); // red,blue,green

alert(colors); // red,blue,green

延伸:就是用toString()方法可以用console.log实现alert数组的效果

最新文章

  1. jquery的each()详细介绍
  2. Centos7 安装 nodejs
  3. 浅谈export 以及环境变量
  4. install zabbix-agent on CENTOS
  5. sellect、poll、epoll
  6. GAC(Global Assembly Cache)注册/卸载 dll
  7. PL/SQL在win7X 64下安装
  8. 大家来找茬-SpringMVC中Tomcat正常启动,始终访问不了Controller,出404错
  9. operator= 复制操作符的意外
  10. 20 Zabbix系统性能优化建议
  11. Fiddler修改图片显示
  12. Linux过滤错误日志
  13. Hadoop-调优剖析
  14. 8.6 正睿暑期集训营 Day3
  15. 20170821xlVBA跨表公式套用
  16. matlab std函数 用法及实例
  17. Alpha阶段敏捷冲刺③
  18. D. Arpa and a list of numbers Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)
  19. 一个highcharts混合图Demo
  20. JavaScript 使用 php 的变量

热门文章

  1. Django Python MySQL Linux 开发环境搭建
  2. ros 安装c++编译的可执行文件
  3. JMeter源码导入到Intellij IDEA
  4. RabbitMQ入门_08_所谓的点对点与发布订阅模型
  5. 新的请求方式 fetch和axios
  6. ASCII 和 Unicode 编码的由来
  7. CDS & ORF & 启动子 & 终止子 & 转录因子 & 基因结构 & UTR
  8. Ubuntu 18.04 LTS 安装wine 、exe程序安装和卸载
  9. The requested URL /phpmyadmin was not found on this server.
  10. Leetcode 89