本章節利用 Array.prototype.forEach() 迭代 + if 的方式,來找出屬性checked 為 true 者↓
AlphaPos.prototype.getCheckedValue = function (inputName) { let selectedOption = ''
// 用迭代去逐個比對, 找出屬性checked為true者…
課文中精華討論, 蠻有趣的。我這邊也試著分別用Chrome & Firefox開測試用的CodePen。顯示結果確實是Chrome會爆版, Firefox也會…
跟字串需要用「 “ 」這類符號包起來一樣正規表達式需要用「/」包裹
'string'/regexp/
針對延伸閱讀的內容:
/^\d{4}-?\d{6}$/
^x => x在字首\d => 數字, 等價於[0-9]{n} => 重複次數nx? => (有x or 沒有x),皆匹配x$…
這次A22挑戰題, 學長姐精選作業中, 有學長姐使用了一個沒看過的方法,將 Array-like 轉換成 Array 來進行 .forEach() 迭代。
根據這篇的教學內容, 以及之前跟助教們的一些討論, 終於越來越明晰IIFE到底是幹嘛的。今天在查找IIFE相關資料時, 看到了一些有趣的內容。
javascript 模仿块级作用域 — wangjun5159的专栏 — CSDN博客
這篇大意是在說明IIFE是如何產生的, 以及為何需要IIFE?
如題,想請問現在是否可直接用 Block Statement 來取代 IIFE?
U86~ U89 這個單元使用了IIFE, 來避免汙染存在於全域的變數。而 IIFE 是 ES6 以前的技巧。
這篇的專有名詞比較多, 而且是蠻重要的部分。對於這塊不太熟的同學, 可能會被名詞搞得很繞。
分享一下個人的理解方式:其實給 Obj 賦值, 就是對 Obj 貼上一張寫著 “別稱” 的貼紙
const a = ['a', 'b'] // 在這個 [] 框框上, 貼上貼紙, 寫著aconst b = a…
(前略)switch (prop) { case 'genre': let genre = genreFormatter(user[prop]) (後略)}
本章節switch的練習中, 當我在case底下宣告變數時,ESLint出現了警告
Unexpected lexical declaration in…
(前略)
這個範例讓我驚呆了XDJS居然會允許Array裡放入 ( key: value ) 這種格式的…. 值???我剛才用Ruby測試了一下, Ruby中這種操作是不合法的
寫作業碰到問題,用的關鍵字方向不對, 查好久查不到解,正想說放棄掙扎來問助教時, 腦中閃過另一個關鍵字時, 終於給我查到了!!
在這邊分享一下。一組加入事件監聽器的code如下:
HTMLElement.addEventListener('click'…