看到使用 Codewar 作為自我練習 也想推薦一個資源:
30 seconds of code
它標榜收集了 可以在三十秒內理解的實用 JS code
用起來個人覺得有幾個優點:
個人會在瀏覽器 console 下這段程式碼『隨機閱讀』,像是背英文單字卡一樣跳著看。
snippets = document.querySelectorAll('pre.language-js:nth-child(3)');
topics = document.querySelectorAll('h3.section');
topics[Math.round(Math.random()*topics.length)].scrollIntoView(true);
或是把程式碼當作答案:先遮起來,讀題目想一想,想不到再移動滑鼠看答案
document.querySelectorAll('pre.language-js').forEach(el => {
if (el.nextSibling.nodeName === 'LABEL') {
el.style.opacity = 0.03;
el.onmouseenter = function() { this.style.opacity = 1; }
el.onmouseleave = function() { this.style.opacity = 0.03; }
}})
看到使用 Codewar 作為自我練習 也想推薦一個資源:
它標榜收集了 可以在三十秒內理解的實用 JS code
用起來個人覺得有幾個優點:
個人會在瀏覽器 console 下這段程式碼『隨機閱讀』,像是背英文單字卡一樣跳著看。
或是把程式碼當作答案:先遮起來,讀題目想一想,想不到再移動滑鼠看答案