Open Lichen5221 opened 3 years ago
刪除一個陣列元素會在陣列上留下一個「洞」,而且不會改變陣列長度。
for 迴圈
for (let i = 1; i <= 9; i++) { console.log(i) }
while 迴圈
var n = 1 while (n <= 9) { console.log(n); n++; }
function copy(n) { for (let i = 1; i <= n; i++) { console.log(i) } } copy(9) copy(30)
var i = 1 function copy(n) { while (i <= n) { console.log(i); i++; } } copy(5)
let s = '' function star(n) { for (let i = 1; i <= n; i++){ s += '*' } console.log(s) } star(10)
let s = '' let i = 1 function star(n) { while (i <= n) { s += '*'; i++; } console.log(s) } star(5)
let s = '' function star(n) { for (let i = 1; i <= n; i++){ s += '*' } return s } star(10)
let s = '' let i = 1 function star(n) { while (i <= n) { s += '*'; i++; } return s } console.log(star(5))
function isUpperCase(str) { let ascii = str.charCodeAt(0) if (ascii >= 65 && ascii <= 90) { return true } return false }
閱讀 Javascript 大全(犀牛 6E )
刪除一個陣列元素會在陣列上留下一個「洞」,而且不會改變陣列長度。
JS101 綜合題目練習 Lv 1
印出 1 ~ 9
for 迴圈
while 迴圈
印出 1 ~ n
for 迴圈
while 迴圈
寫一個能夠印出 n 個 * 的函式
for 迴圈
while 迴圈
寫一個能回傳 n 個 * 的函式
for 迴圈
while 迴圈
判斷大小寫
回傳第一個大寫字母以及它的 index