This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esnext: true */ | |
var calculator = document.getElementById('calculator'); | |
var output = document.getElementById('calculator-output'); | |
calculator.addEventListener('click', calculatorClick); | |
function calculatorClick(event) { | |
var target = event.target; | |
var dataset = target.dataset; | |
var value = dataset.value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esnext: true */ | |
var calculator = document.getElementById('calculator'); | |
var output = document.getElementById('calculator-output'); | |
calculator.addEventListener('click', calculatorClick); | |
function calculatorClick(event) { | |
var target = event.target; | |
var dataset = target.dataset; | |
var value = dataset.value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Calculator</title> | |
</head> | |
<body> | |
<div id="calculator" class="calculator"> | |
<div class="calculator-display"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Calculator</title> | |
</head> | |
<body> | |
<div id="calculator" class="calculator"> | |
<div class="calculator-display"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Calculator</title> | |
</head> | |
<body> | |
<div class="calculator"> | |
<div class="calculator-display"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/div/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title> DeviceInfo </title> | |
<style> | |
body { | |
font-size: 16px; | |
color: black; | |
background-color: white; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 123 => 6 | |
// 199 => 19 -> 10 -> 1 | |
// function numberToDigit(number) { | |
// var result = Array | |
// .from(number.toString()) | |
// .reduce(function (acc, digit) { | |
// acc += parseInt(digit); | |
// return acc; | |
// }, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// digit sum | |
// easy way | |
function digitSum(number) { | |
number = Array | |
.from(number.toString()) | |
.reduce(function(acc, n){ | |
return acc + parseInt(n); | |
},0); | |
if (number > 9) number = digitSum(number); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
console.log(deepReverse('a1(b2(c1))a1')); // => a1(2b(1c))a1 | |
**/ | |
var string = '1a(2b(c1))a1'; | |
function deepReverse(string, deep){ | |
var length = string.length; | |
var i = 0; | |
var collect = []; | |
var deep = deep || false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Study Guide | |
JavaScript | |
[ ] Prototype Inheritance | |
[ ] Understand how this works | |
[ ] OO programming | |
[ ] Module Pattern | |
[ ] ES6 Classes | |
[ ] Definition | |
[ ] Inheritance |