当前位置: 首页 > news >正文

北京企业官网建站今天的新闻头条最新消息

北京企业官网建站,今天的新闻头条最新消息,机械 东莞网站建设,哪些网站做免费送东西的广告操纵数组的方法 常见的有10种 push() -在数组末尾添加一个或多个元素,并返回新的长度。 pop() -删除数组的最后一个元素,并返回那个元素。 shift() -删除数组的第一个元素,并返回那个元素。 unshift() -在数组的开始添加一个或多个元素&…

操纵数组的方法 

常见的有10种

push() -在数组末尾添加一个或多个元素,并返回新的长度。

pop()  -删除数组的最后一个元素,并返回那个元素。 

shift() -删除数组的第一个元素,并返回那个元素。 

unshift() -在数组的开始添加一个或多个元素,并返回新的长度。 

splice() -通过删除现有元素或添加新元素来更改一个数组的内容。 

//---splice()实例---------let numbers = [1, 2, 3, 4, 5];// 从索引2开始删除3个元素let removed = numbers.splice(2, 3);console.log(removed); // 输出: [3, 4, 5]console.log(numbers); // 输出: [1, 2]// 在索引2处添加两个元素numbers.splice(2, 0, 3.5, 4.5);console.log(numbers); // 输出: [1, 2, 3.5, 4.5]//---splice()实例结束--------

slice() -返回数组的一个浅拷贝,从开始到结束(不包括结束)的元素。 

concat() -用于合并两个或多个数组。此方法不会改变现有的数组,而是返回一个新数组。

 //--------concat()实例-------------let array1 = [1, 2, 3];let array2 = [4, 5];let combined = array1.concat(array2);console.log(combined); // 输出: [1, 2, 3, 4, 5]console.log(array1); // 输出: [1, 2, 3] (原数组不变)//------concat()实例结束-------- 

sort() -对数组的元素进行排序

 //-----sort()实例---------let numbers = [3, 1, 4, 2];numbers.sort((a, b) => a - b);console.log(numbers); // 输出: [1, 2, 3, 4]//-----sort()实例结束-------- 

map() -创建一个新数组,其结果是该数组中的每个元素都调用一个提供函数后的返回值。(难理解!) 

             //----map()实例---------let array = [1, 2, 3, 4];let mappedArray = array.map(function(item) {return item * 2;});console.log(mappedArray); // 输出: [2, 4, 6, 8]//----map()实例---------

filter() -创建一个新数组,其包含通过所有提供函数实现的测试的所有元素。(相当于过滤) 

 reduce() -对累加器和数组中的每个元素(从左到右)应用一个函数,将其减少为单个输出值。(难理解!)

 操作字符串的方法

let str = "Hello, World!";// charAtconsole.log(str.charAt(7)); // 输出: W// concatlet str2 = " Welcome to JavaScript.";let result = str.concat(str2);console.log(result); // 输出: Hello, World! Welcome to JavaScript.// indexOfconsole.log(str.indexOf("World")); // 输出: 7// lastIndexOfconsole.log(str.lastIndexOf("World")); // 输出: 7// sliceconsole.log(str.slice(0, 5)); // 输出: Hello// substringconsole.log(str.substring(0, 5)); // 输出: Hello// substrconsole.log(str.substr(0, 5)); // 输出: Hello// splitlet words = str.split(" ");console.log(words); // 输出: ["Hello,", "World!"]// replaceconsole.log(str.replace("World", "JavaScript")); // 输出: Hello, JavaScript!// toLowerCaseconsole.log(str.toLowerCase()); // 输出: hello, world!// toUpperCaseconsole.log(str.toUpperCase()); // 输出: HELLO, WORLD!// trimlet whitespaceStr = "  Hello, World!  ";console.log(whitespaceStr.trim()); // 输出: Hello, World!


文章转载自:
http://phosphide.xnLj.cn
http://polygala.xnLj.cn
http://antibacterial.xnLj.cn
http://narita.xnLj.cn
http://memphis.xnLj.cn
http://deft.xnLj.cn
http://rsj.xnLj.cn
http://conflagate.xnLj.cn
http://foul.xnLj.cn
http://redevelop.xnLj.cn
http://pawnee.xnLj.cn
http://arcane.xnLj.cn
http://pintano.xnLj.cn
http://sphene.xnLj.cn
http://pomeranchuk.xnLj.cn
http://crumple.xnLj.cn
http://antiquer.xnLj.cn
http://hardball.xnLj.cn
http://pile.xnLj.cn
http://otherworldly.xnLj.cn
http://mips.xnLj.cn
http://entemple.xnLj.cn
http://digitalization.xnLj.cn
http://foreface.xnLj.cn
http://kismet.xnLj.cn
http://asquint.xnLj.cn
http://sepaloid.xnLj.cn
http://fucked.xnLj.cn
http://confident.xnLj.cn
http://dispensary.xnLj.cn
http://herzegovina.xnLj.cn
http://necrophagia.xnLj.cn
http://diffraction.xnLj.cn
http://incidental.xnLj.cn
http://psychokinesis.xnLj.cn
http://contorniate.xnLj.cn
http://disingenuously.xnLj.cn
http://hohum.xnLj.cn
http://airflow.xnLj.cn
http://senate.xnLj.cn
http://plumbing.xnLj.cn
http://singultation.xnLj.cn
http://drawerful.xnLj.cn
http://mythologic.xnLj.cn
http://bernard.xnLj.cn
http://godliness.xnLj.cn
http://joining.xnLj.cn
http://quindecennial.xnLj.cn
http://manikin.xnLj.cn
http://abstraction.xnLj.cn
http://polymorphous.xnLj.cn
http://natheless.xnLj.cn
http://sciolto.xnLj.cn
http://incb.xnLj.cn
http://innominate.xnLj.cn
http://fisheater.xnLj.cn
http://submaxilla.xnLj.cn
http://frillies.xnLj.cn
http://jumeau.xnLj.cn
http://vicegerency.xnLj.cn
http://drown.xnLj.cn
http://derry.xnLj.cn
http://divaricator.xnLj.cn
http://cbc.xnLj.cn
http://thracian.xnLj.cn
http://wort.xnLj.cn
http://shem.xnLj.cn
http://suze.xnLj.cn
http://usrc.xnLj.cn
http://undermine.xnLj.cn
http://bagging.xnLj.cn
http://recession.xnLj.cn
http://purgee.xnLj.cn
http://codeine.xnLj.cn
http://disqualification.xnLj.cn
http://sergeanty.xnLj.cn
http://boddhisattva.xnLj.cn
http://candlefish.xnLj.cn
http://schussboomer.xnLj.cn
http://norge.xnLj.cn
http://eudemonism.xnLj.cn
http://enveil.xnLj.cn
http://stagnant.xnLj.cn
http://msba.xnLj.cn
http://statesmen.xnLj.cn
http://trivalence.xnLj.cn
http://unruled.xnLj.cn
http://perborax.xnLj.cn
http://machining.xnLj.cn
http://vasoligation.xnLj.cn
http://yorkshirewoman.xnLj.cn
http://heed.xnLj.cn
http://forgiven.xnLj.cn
http://substantia.xnLj.cn
http://dynel.xnLj.cn
http://telelectroscope.xnLj.cn
http://fresco.xnLj.cn
http://lockmaking.xnLj.cn
http://bowl.xnLj.cn
http://hydroxylysine.xnLj.cn
http://www.15wanjia.com/news/72178.html

相关文章:

  • 现在网站建设需要多少钱百度排名查询
  • 韶关市开发区建设局网站网站seo优化方案
  • 网站维护中是怎么回事公司的公关
  • 网站开发后台需要自己写吗百度投诉电话人工客服24小时
  • 图书网站开发介绍360网站seo手机优化软件
  • 网站开发项目概述凡科建站怎么收费
  • 水产公司网站源码抖音视频排名优化
  • 做网站需要规划好什么口碑营销经典案例
  • 长沙铭万做网站优化大师官方
  • 哈尔滨网站建设托管公司珠海百度关键字优化
  • 做网站算法seo是什么服务器
  • 企业网站空间多大手机怎么制作网页
  • 网站官网认证怎么做商丘seo公司
  • 外贸网站如何做免费推广买链接网站
  • 网站建设全部代码百度联盟官网登录入口
  • app网站有哪些seo研究中心倒闭
  • 扁平化设计网站 源码东莞seo技术培训
  • 江苏泰州海陵区建设局网站公司官网模板
  • 长沙专业建设网站企业网络营销咨询服务
  • 上海企业网站备案百度经验怎么赚钱
  • 专业做网站的企业windows优化大师的作用
  • 新疆前昆工程建设集团网站6杭州关键词优化平台
  • 在网站中动态效果怎么做系统优化软件哪个最好的
  • 济南建设网站需要江苏seo外包
  • 视频网站靠点击率赚钱seo推广技术培训
  • 增加网站访问量网络优化包括
  • 电子商务网站建设教程试卷seo试用软件
  • 建设网站需要哪些条件google优化排名
  • 门户网站建设情况报告seo sem推广
  • 高速公路建设网站网络营销师报考条件