-
访问对象的属性
const bb = { name: 'Beibei', age: 20, }; 通过.语法访问。bb.name 通过[]语法。bb['name'] 对象的属性名有两种类型,一种是字符串,另一种是数字。 const zh = { name: '中国', 0: '北京', 1: '上海', 2: '广州', }; name属性名就是字符串类型,对象zh的其它属性为数字类型。 字符串类型的属性名可以用上面两种方式访问。 数字类型的属性,只能使用方括号形式方式。 console.log(zh[0], zh[1], zh[2]); Read More
-
字符串截取
String.prototype.slice() str.slice(indexStart[, indexEnd]) 截取字符串的一部分,从indexStart位置开始(包含该位置),到indexEnd位置结束(不包含结束位置); ![[Pasted image 20230414230120.png]] 若之传入indexStart,则从该位置截取到末尾; ![[Pasted image 20230414230815.png]] indexStart和indexEnd可以是负数,-1代表最后一位,截取时不包含该位置。 ![[Pasted image 20230414230053.png]] ![[Pasted image 20230414231600.png]] 当indexEnd... Read More
-
Welcome to Jekyll!
You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated. Jekyll requires blog post files to be named according ... Read More