forked from ccccourse/wp109b
-
Notifications
You must be signed in to change notification settings - Fork 0
week9.md
jenny126 edited this page Jun 18, 2021
·
6 revisions
let add=founction(a,b)
return a+b;
這種寫法等於是把founction放入add這個變數中
function modify(num, array) {
num = num + 1;
array[0] = array[0] + 1; }
var n=3, a=[3,2,1];
modify(n, a);
console.log("n=", n, " a=", a);
來源:陳鍾誠老師的教學網站
變數上的改變如果沒有return則不會改變,因為改變的值是變數的複製檔,沒有回傳回去就不會產生變化。
但在陣列上並非如此(陣列複製的不是值,而是位置),所以陣列不需要return
基本型態在founction裡面改了沒用,物件型態在founction裡面改了有用
function sub(a,b) {
return a-b;
}
function f5(f, a) {
return f(a, 5);
}
console.log("sub(8,5)="+sub(3, 5));
console.log("f5(sub,8)="+f5(sub,8));
來源陳鍾誠老師的gitlab 因為f被指派為sub,a被指派為8,因此f5(sub,8)=3>>sub(8,5)
資料及參考來源:
陳鍾誠老師的個人網頁
陳鍾誠老師的GITLAB
W3SCHOOL
- CSS Introduction
- Selectors 選擇器
- 註解 Comment
- How to put css in your web
- 顏色 color
- Backgrounds
- Box Model
- Border
- Margins
- Padding
- Outline
- Text
- Icon
- Links
- Lists
- Tables 表格
- display
- width and max-width
- position
- Overflow