Skip to content

Commit 4d81584

Browse files
committedMar 12, 2018
Merge branch 'master' into third-edition
# Conflicts: # .gitignore # chapter01/01-HelloWorld.js # chapter01/04-TruthyFalsy.js # chapter01/05-EqualsOperators.js # chapter01/06-ConditionalStatements.js # chapter01/14-ES6ParameterHandling.js # chapter02/01-Introduction.js # chapter02/02-CreatingAndInitialingArrays.js # chapter02/03-AddingRemovingElements.js # chapter02/04-TwoDimensionalMultiDimensional.js # chapter02/05-ArrayMethods.js # chapter03/03-BalancedSymbols.html # chapter03/04-DecimalToBinary.html # chapter03/04-DecimalToBinary.js # chapter03/05-TowerOfHanoi.html # chapter04/03-PriorityQueue.html # chapter04/04-HotPotato.html # chapter06/03-Operations.html # chapter07/02-UsingDictionaries.html # chapter07/03-HashTable.js # chapter07/04-UsingHash.html # chapter07/04-UsingHash.js # chapter07/06-UsingHashCollisionSeparateChaining.js # chapter07/08-UsingHashCollisionLinearProbing.html # chapter08/01-BinarySearchTree.js # chapter09/02-UsingGraphs.html # chapter09/02-UsingGraphs.js # chapter11/01-Recursion.html # chapter11/01-Recursion.js # chapter11/02-InfiniteRecursion.html # chapter11/02-InfiniteRecursion.js # chapter11/03-MinCoinChangeDP.html # chapter11/04-MinCoinChangeGreedy.html
2 parents ef79e85 + 208b757 commit 4d81584

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1092
-0
lines changed
 

‎chapter01/01-HelloWorld.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function output(t) {
2+
document.write('<p>' + t + '</p>');
3+
return;
4+
}
5+
6+
alert('Hello, World!');
7+
console.log('Hello, World!');
8+
output('Hello, World!');

‎chapter01/04-TruthyFalsy.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function testTruthy(val){
2+
return val ? console.log('truthy') : console.log('falsy');
3+
}
4+
5+
testTruthy(true); //true
6+
testTruthy(false); //false
7+
testTruthy(new Boolean(false)); //true (object is always true)
8+
9+
testTruthy(''); //false
10+
testTruthy('Packt'); //true
11+
testTruthy(new String('')); //true (object is always true)
12+
13+
testTruthy(1); //true
14+
testTruthy(-1); //true
15+
testTruthy(NaN); //false
16+
testTruthy(new Number(NaN)); //true (object is always true)
17+
18+
testTruthy({}); //true (object is always true)
19+
20+
var obj = {name:'John'};
21+
testTruthy(obj); //true
22+
testTruthy(obj.name); //true
23+
testTruthy(obj.age); //age (prop does not exist)

0 commit comments

Comments
 (0)