2021鐵人賽
突然出現在我身後的三人組是!鄭列,方函式,阿物件
而三人中,站在最前方的就是鄭列。
三人:要知道,我們跟那些姊姊可不一樣,她們只會在那亂叫轉型OO,我們還有自己的血繼限界(??)跟招式的。
鄭列:我,很擅長收納,且很喜歡根據數字排序的收納方式,只要是JS希望我收的,什麼類型的垃圾我都收。
我:… (不愧是工具人)
x = ["JS的水","JS不要的垃圾","JS的指甲"];
//對應的索引值
[0] = "JS的水"
[1] = "JS不要的垃圾"
[2] = "JS的指甲"
let x = ["JS的水",9487,function(){return "cool"},{name:"Js",age:56,}]
console.log(x[0])
console.log(x[1])
console.log(x[2])
console.log(x[3])
+:unshift
,-:shift
)+:push
,-:pop
)
x = ["JS的水","JS不要的垃圾","JS的指甲"];
//1.新增內容
//把新的內容加在頭,並回傳新的陣列長度
x.unshift("JS要放在頭的東西")
console.log(x,"unshift");
//把新的內容加在尾,並回傳新的陣列長度
x.push("JS要放在尾的東西")
console.log(x,"push");
//2.減去內容
//頭
x.shift()
console.log(x,"shift");
//尾
x.pop();
console.log(x,"pop");
阿物件:我,很擅長收納,喜歡根據名稱的收納方式,只要是JS希望我收的,什麼類型的垃圾我都收。
let x = {
name:"JS",
age:888,
interested:function(){console.log("cool")},
toolMenList: ["array","function","object"],
}
//簡單建立一個方法&屬性
x.friend = String;
console.log(x.friend)
let x = {
name:"JS",
age:888,
interested:function(){console.log("cool")},
toolMenList =["array","function","object"],
}
如何為物件刪減properties:
增加properties(特性)
減少properties(特性)
delet
+ properties 名稱
let x = {
name:"JS",
age:888,
interested:function(){console.log("cool")},
toolMenList: ["array","function","object"],
}
//簡單建立一個方法&屬性:
//1.點運算子
x.friend = String;
console.log(x.friend)
//2.[]運算子
x["cool"] = "cool!";
console.log(x.cool);
//delet
delet x.cool
//接下來就不會看到cool這個特性了
– to be continued –
那今天就到這邊摟!今天分享喜歡的歌是:
李宗盛 Jonathan Lee【寂寞難耐 Suffering of loneliness】Official Music Video
https://www.youtube.com/watch?v=M3k9PhyNEto
每天的休息,是為了後面的追求,明天見。
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing