開発環境
- macOS Sierra - Apple (OS)
- Emacs (Text Editor)
- JavaScript (プログラミング言語)
- Safari(Web browser)
Head First JavaScript Programming (Eric T. Freeman (著)、Elisabeth Robson (著)、O'Reilly Media)の Chapter 7.(Serious types - Types, Equality, Conversion and All That Jazz)の WHO AM I?(No. 4025)を取り組んでみる。
WHO AM I?(No. 4025)
コード(Emacs)
HTML5
<pre id="output0"></pre> <button id="run0">run</button> <button id="clear0">clear</button> <script src="sample1.js"></script>
JavaScript
let btn0 = document.querySelector('#run0'), btn1 = document.querySelector('#clear0'), pre0 = document.querySelector('#output0'), p = (x) => pre0.textContent += x + '\n'; let output = () => { let v, o = {a:1, b:2}; delete o.b; [ [(() => {return})(), undefined], [v, undefined], [[][1], undefined], [o.c, undefined], [o.b, undefined] ].forEach((x) => { p(((a, b) => a === b)(...x)); }); }; btn0.onclick = output; btn1.onclick = () => pre0.textContent = ''; output();
0 コメント:
コメントを投稿