-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
1474 lines (1217 loc) · 30.6 KB
/
index.js
File metadata and controls
1474 lines (1217 loc) · 30.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//console.log("Hello from JavaScript");
var number = 5;//in-line
/**
* other comment
* Data types:
* underfined, null, boolean, string, symbol, number and object
*/
var myName = 'Beau';
myName = 8;
let ourName = 'freeCodeCamp';
const pi = 3.14;
var a;
var b = 17;
var c = 12
a=b;
//console.log(a+b);
//increment
a++;
//decrement
a--;
//floats
var x = 5.7
//multiply decimals
var product = 2.0 * 0.0;
// divide
var quotient = 4.4/2.0;
// finding a remainder
var r = 11 % 3;
// compound Assignment with Augmented Addition
a += 12;
b += 9;
c += 7;
// compound Assignment with Augmented multiplication
a -= 6;//a = a - 6;
b -= 15;//b = b -15;
c -= 1;//c = c -1;
// compound Assignment with Augmented division
a /= 12;
b /= 4;
c /= 11;
// Declare String Variables
//example:
var firstName = 'Alan';
var lastName = 'Turing';
//only change code below this line
var myFristName = 'Beau';
var myLastName = 'Carnes';
//Escaping Literal Quotes in Strings
var myStr = 'i am a \'double quoted\' string inside\'double quotes';
//console.log(myStr);
//Quoting Strings with Single Quotes
myStr = '<a href="http://" target="_blank">link</a>'
//Concatenating Strings with Plus Operator
var ourStr = " i com first." + "i come second";
//console.log(ourStr);
myStr = "This is the frist sentence. ";
myStr += "This is the second sentence.";
//ex
ourName = "freeCodeCamp";
var ourStr = "@P21: Hello, our name is " + ourName + "how are you?";
// Only change code below this line
myName = "Beau"
myStr = "@P2: My name is " + myName + " and I am well!";
//console.log(myStr);
//Appending Variables to Strings
var anAdjective = "awesome!";
ourStr = "FreeCodeCamp is ";
ourStr += anAdjective;
// Only change code below this line
var someAdjective = "worthwhile"
myStr = "Learning to code is ";
myStr +=someAdjective;
//console.log(myStr);
// find the length of String
var lastNameLength = 0;
lastName = "Baeu";
lastNameLength = lastName.length;
//console.log(lastNameLength);
// Bracket Notation to Find Frist Character in String
//ex
var firstLetterOfFristName = "";
var firstName = "Ada";
firstLetterOfFristName = firstName[0];
// setup
var firstLetterOfLastName = "";
lastName = "Lovelace";
// only change code below this line
firstLetterOfLastName = lastName[0];//first latter[L]
// String immutability
//setup
myStr = "Jello World";
// only change code below this line
myStr = "Hello World";
// Bracket Notation to find Nth Character in String
var thirdLetterOfLastName = lastName[2];//[find]
// Bracket Notation to find last Character in String
var lastLetterofLastName = lastName[lastName.length-1];
//console.log(lastLetterofLastName);
// Bracket Notation to find Nth-to-last Character in String
var secondToLastLetterOfLastName = lastName[lastName.length-2];
// word blanks
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// Your code below this line
var result = "";
result+= "the " + myAdjective +" "+ myNoun +" "+ myVerb + " to the store "+ myAdverb+ " ";
// Your code above this line
return result;
}
// change the words here to test your function
//console.log(wordBlanks("dog", "big", "ran", "quickly"));
/**Store Multiple Values with Arrays */
//Example
var ourArray = ["John", 23];
// only change code below this line
var myArray = ["Quincy", 43];
// Nested Arrays or Multidimensional arrays
//Example
ourArray = [["John", 42], ["everything", 101010]];
// only change code below this line
var myArray = [["Bulls", 23], ["White sox", 45]];
// Access Array Data with Indexes
ourArray = [18,64,99];
ourArray[1]=45;//changing the value of index[1] to 45
//set up
myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13,14,]];
// access
var myData = myArray[2][1];
//console.log(myData);
//Manipulate Arrays with push
ourArray = ["Stimpson", "J", "cata"];
ourArray.push(["Happy", "joy"])
// remove items from array
ourArray = [1,2,3];
var removedFromArray = ourArray.pop();
// removedFromOurArra now equals 3, and ourArray now equals [1,2]
// set
myArray = [["Jose", 23], ["cat", 2]];
// only change code below this line
removedFromArray = myArray.pop();// myArray is now: [["Jose", 23]]
console.log(myArray);
//Munipulate Arrays with shift()
ourArray = ["Stimpson", "J", ["cata"]];
removedFromArray = ourArray.shift();// stipmson is being removed: ["J", "cata"]
//setup
myArray = [["jose", 23], ["rex", 3]];
removedFromArray = myArray.shift();
//ex
ourArray = ["Stimpson", "J", "cata"];
ourArray.shift();// ourArray now equals ["J", "Cat"]
ourArray.unshift("Happy")//ourArray now equals ["Happy", "J", "cat"]
//setup
myArray = [["jose", 23], ["rex", 3]];
myArray.shift();
// only change code below this line
myArray.unshift(["Paul", 35]);
console.log("---------------------------------")
console.log(myArray);
/*************Shopping List *************/
//example:
var mylist = [["cereal", 3], ["milk", 2], ["bananas", 3], ["juice", 2], ["eggs", 3],]
/**Write Reusable Code with Functions */
//ex:
function ourReusableFuncton () {
console.log("Heyya, World!")
}
ourReusableFuncton();
// Only change code below this line
function reusableFuncton () {
console.log("Hi, World!")
}
reusableFuncton();
// Passing values to Functions with Arguments
function ourfunctionWithArgs(a, b) {
console.log("************************** \n: ("+a+" + "+b+") = " + (a - b));
}
ourfunctionWithArgs(10, 5); // outputs 5
/************** GLOBAL SCOPE and FUNCTIONs ************** */
// Declare your variable here
// var myGlobal = 10;
// function fun1(){
// // Assign 5 to oopsGLobal here
// oopsGLobal = 5;
// }
// function fun2(){
// var output = "";
// if(typeof myGlobal != "underfined") {
// output+="myGlobal: " + myGlobal;
// }
// if(typeof oopsGLobal != "underfined") {
// output+="myGlobal: " + oopsGLobal;
// }
// console.log(output);
// }
// fun1();
// fun2();
// // Local Scope and Functions
// function myLocalScope () {
// var myVar = 5;
// console.log(myVar);
// }
// myLocalScope();
/**Global vs Scope in Functions */
var outerWear = "T-Shirt";
function myOutfit() {
return outerWear;
}
console.log(myOutfit());
// Only change code below this line
// Return a value from a function with Return
function minusSeven(num) {
return num -7;
}
console.log(minusSeven(10));
function timesFive(num) {
return num * 5;
}
console.log(timesFive(5));
// Understanding Undefined Value Returned from a Function
//Example:
console.log('========================================');
var sum = 0;
function addThree() {
sum = sum + 3;
// will not return nothing...R: Underfined Value...
//return sum; // the return is key to not be undefined ..
}
console.log(addThree())
// Comparison with the Less Than Or Equal To Operator
function testLessOrEqual(v){
if(v <= 12) {
// Change this line
return "Smaller Than or Equal to 12";
}
if(v <= 24) {
return "Smaller Than or Equal to 24";
}
return "More Than 24";
}
//Comparisons with the Logical "And" Operator
function testLogicalAnd(v) {
//Only change code below
if(v <= 50 && v >= 25) {
return "Yes";
}
//only change code above this line
return "No";
}
testLogicalAnd(10);
//Comparisons with the Logical 'OR' Operator
function testLogicalOr(v) {
//Only change code below
if(v < 10 || v > 20) {
return "outside";
}
//only change code above this line
return "Inside";
}
testLogicalAnd(10);
/**ELSE STATEMENTS */
function testElse( ){
var result = "";
// Only change code below this line
if(v > 5){
result = "Bigger than 5";
}
if(v <= 5) {
result = "5 or Smaller";
}
//Only change code above this line
return result;
}
//teste else If statements
function testElseIf(v) {
if(v > 10){
result = "Greater than 10";
}else if(v < 5) {
result = "Smaller than 5";
}else{
//Only change code above this line
return "Between 5 and 10";
}
}
// Logical Order in If Else Statements
function orderMyLogic(v){
if(v < 10) {
return "Less than 10";
} else if(v < 5) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}
orderMyLogic(3);
//Chaining If Else Statements
function testSize(n){
if( n < 5) {
return "Tiny";
}
else if(n < 10){
return "Small";
}else if(n < 15) {
return "Medium";
}else if(n < 20) {
return "Large";
}else {//if (n > 20)
return "Huge";
}
}
testSize(6);
// GOlF CODE
var names = ["Hole-in-one!", "Birde", "Par", "Bogey", "Double Bogey", "C"];
function golfScore(par, strokes) {
if (strokes == 1) {
return names[0]
}else if (strokes <= par - 2) {
return names[1]
}else if (strokes == par - 1) {
return names[2]
}else if (strokes == par) {
return names[3]
}else if (strokes == par + 1) {
return names[4]
}else if (strokes == par + 2) {
return names[5]
}else if (strokes >= par + 3) {
return names[6]
}
}
golfScore(5, 4);
// Switch Statements
function caseInSwitch(v) {
var answer = "";
switch (v) {
case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";
break;
}
return answer;
}
caseInSwitch(1);
// switch OF Stuff
function switchOfStuff(v) {
var answer = "";
switch (v) {
case "a":
answer = "apple";
break;
case "b":
answer = "bird";
break;
case "c":
answer = "cat";
break;
default:
answer = "stuff";
break;
}
return answer;
}
// change this value to test
console.log(switchOfStuff("a"));
// Multiple Indentical Options in Switch Statements
function sequentialSizes(v) {
var answer = "";
switch(v){
case 1:
case 2:
case 3:
answer = "Low";
break;
case 4:
case 5:
case 6:
answer = "Medium";
break;
case 7:
case 8:
case 9:
answer = "High";
break;
default:
answer = "Too High";
}
return answer;
}
// console.log(sequentialSizes(5));
// Replacing If Else Chains with Switch
function chainToSwitch(v) {
var answer = "";
// Only change code below
switch(v){
case "bob":
answer = "Marley";
break;
case 42:
answer = "The Answer";
break;
case 1:
answer = "The is no #1";
break;
case 99:
answer = "Missed me by this much!";
break;
case 7:
answer = "Ate Nine";
break;
}
return answer;
}
chainToSwitch(7);
// Returning Boolean Values From Functions
function isLess (a,b) {
//fix this code
return a < b;
}
//Change these values to test
isLess(10, 15);
// Returning Early Pattern from Functions
function abTest(a, b) {
// Only change code below this Line
if(a < 0 || b < 0){
return undefined;
}
//Only Change code above this line
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
console.log(abTest(2,2));
// Counting Cards
function cc(card) {
var count = 0;
switch (card) {
case 2: break;
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}
var holdbet = 'Hold';
if(count > 0) {
holdbet = 'Bet';
}
return count + " " + holdbet;
}
cc("k");
console.log(cc("J"));
/**Build JavaScript Objects */
var ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"]
};
// only change code below this line..
var myDog = {
"name": "Camper",
"legs": 3,
"tails": 2,
"friends": [""]
};
// Acessing Object Properties with Dot Notation
var testObj = {
"hat": "ballcap",
"shirt": "Jersey",
"shoes": "cleats"
};
//Only chage code below this line
var hatValue = testObj.hat; // change this line
var shirtValue = testObj.shirt; //Change this Line
//Acessing Object Properties with Bracket Notation
testObj = {
"an entree": "hamburger",
"my side": "veggies",
"the drink": "water"
};
//Only change code below this line
var entreeValue = testObj["an entree"]; // Change this line
var entreeValue = testObj["the drink"]; // Change this line
// Acessing Object Properties with Variables
var testObj = {
12: "Namadt",
16: "Montana",
19: "Unitas",
};
// Only Change code Below this line
var playerNumber = 16;
var Player = testObj[playerNumber];
console.log(Player);
// Updating Object Properties
//accessing ourDog.name
console.log();
myDog.friends = ["freeCodeCamp Campers"];
ourDog.name = "Happy Camper";
myDog.name = "Happy coder";
// Delete Properties From an Object
delete myDog.tails;
// Using Objects for LooKups
function phoneticLookup(v) {
var r = "";
// Only change code below this line
var lookup = {
"alpha": "adams",
"bravo": "Boston",
"charlie": "Chicago",
"echo":"Easy",
"foxtrot":"Frank",
};
/*switch(v) {
case "Alpha": r="Adams";break;
case "Bravo": r="Boston";break;
case "charlie": r="Chicago";break;
case "delta": r="Denver";break;
case "echo": r="Easy";break;
case "foxtrot": r="Frank"; break;
}*/
r = lookup[v]
return r;
}
console.log(phoneticLookup("echo"));
// Testing Objects for Properties
//setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
// your code Here
if (myObj.hasOwnProperty(checkProp)){
return myObj[checkProp];
}else {
return "Not Found";
}
return "Change Me!";
}
// test your code by modifying these values
console.log(checkObj("gift"));
// Manipulating Complex Objects
var myMusic = [
{
"artist": "Billy Joel",
"title": "piano Man",
"release_year": 1973,
"formats": [
"CD",
"8T",
"LP"
],
"gold":true
},
{
// add record here
"artist": "Beau Carnes",
"title": "Careal Man",
"release_year": 2003,
"formats": [
"YouTube video",
"8T",
"LP"
],
"gold":true
},
];
// Setup
var myStorage = {
"car":{
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},//inside
"outside":{
"trunk": "jack"
}//outside
}//car
};
var gloveBoxContents = myStorage.car.inside["glove box"];// acessing inside
//console.log(gloveBoxContents);
// Accessing Nested Arrays
//Setup
var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
},
];
//Only Change code below this line
var secondTree = myPlants[1].list[0]; //accessing 2 index[1]--"trees"
console.log(secondTree);
// Record Collection
var collection = {
"2548":{
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2568":{
"album": "1999",
"artist": "Price",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245":{
// "album": "",
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439":{
"album": "ABBA Gold",
//"artist": "",
//"tracks": []
},
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));
// only change code below this line
function updateRecords(id, prop, value) {
if(value === ""){
delete collection[id][prop];// delete if our value is empty string
}else if(prop === "tracks") {
//if tracks is empty, will be create
collection[id][prop] = collection[id][prop] || [];
collection[id][prop].push(value);
}else{//if isn't value blank and property isn't track
//just set the property to equal the value
collection[id][prop] = value;
}
//
return collection;
}
// Alter values below to test your code
console.log(updateRecords(5439, "artist", "ABBA"));
/**Iterate With Loops */
// the array is empty
var myArray = [
];
var i = 0;
while(i < 5) {
// put values in array
myArray.push(i);
i++;
}
console.log(myArray);
//Iterate with For Loops
//ex:
ourArray = [];
for (var i=0; i< 5; i++) {
ourArray.push(i);
}
// setup
var myArray = [];
// only change code below this line
for (var i = 1; i < 6; i++) {
myArray.push(i);
}
console.log(myArray );
//Iterate Odd Numbers with a for Loop
ourArray = [];
for (var i = 0; i < 10; i+=2) {
myArray.push(i);
}
console.log(myArray);
myArray =[];
// only change code below this line
for (var i = 1; i < 10; i+=2) {
myArray.push(i);
}
console.log(myArray);
//Count Backwards with a For Loop
ourArray = [];
for (var i = 10; i > 0; i-=2) {
myArray.push(i);
}
console.log(myArray);
// setup
myArray =[];
// only change code below this line
for (var i = 9; i > 9; i-=2) {
myArray.push(i);
}
console.log(myArray);
// Iterate Through an Array with a For Loop
//ex
var ourArr = [9, 10, 11, 12];
var ourTotal = 0;
// only change code below this line
for (var i = 0; i < ourArr.length; i++) {
ourTotal +=ourArr[i];
}
console.log(ourTotal);
// setup
var myArr = [2, 3, 4, 5, 6];
var total = 0;
for (var i = 0; i < myArr.length; i++) {
total += myArr[i];
}
console.log(total);
// Nesting For Loops
function multiplyAll(arr) {
var product = 1;
for (var i = 0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
product *= arr[i][j];
}
}
return product;
}
var product = multiplyAll([[1,2], [3,4], [5,6,7]]);
console.log(product);
// Iterate with Do ...While Loops
myArray = []
var i = 10;
// only change code below this line
do {
myArray.push(i);
i++;
} while (i < 5);
// Profile Lookup
var contacts =[
{
"firstName": "harry",
"lastName": "Potter",
"number": "0543236543",
"likes": ["Pizz", "Coding", "Brownie Points"],
},
{
"firstName": "harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"],
},
{
"firstName": "sharlock",
"lastName": "Holmes",
"number": "0487445643",
"likes": ["Intriguig Cases", "Violin", ""],
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["JavaScript", "gaming", "Foxes"],
},
];
function lookUpProfile(name, prop) {
for (var i = 0; i < contacts.length; i++) {
if(contacts[i].firstName === name) {
return contacts[i][prop] || "Not such property";
}
}
return "No such Contact"
}
//Change these values to test your function
var data = lookUpProfile("sharlock", "likes");
console.log(data);
// Generate Random Fractions
function randomFraction() {
return Math.random();
}
console.log(randomFraction);
// Generate Random wholw Number
var randomNumberBetween0and19 = Math.floor(Math.random() * 20);
function randomWholeNum() {
return Math.floor(Math.random() * 10);
}
console.log(randomWholeNum());
// Gerate Random Whole Numbers within a Range
//ex
function ourRandomRange (ourMin, ourMax) {
return Math.floor(Math.random() * (ourMax - ourMin + 1)) + ourMin;
}
ourRandomRange(1,9);
function randomRange(myMin, myMax) {
return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;
}
var myRandom = randomRange(5, 15);
console.log(myRandom);
//************Use the parseInt Function************** */
// var str;
// function convertToInteger(str) {
// return parseInt(Str);
// }
// convertToInteger("56");
// Use the parseInt Fuction with a Radix
// function convertToInteger(str) {
// return parseInt(Str);
// }
// convertToInteger("10011");
// Use the Conditional (Ternary) Operator
// condition ? statement-if-true : statement-if-false
function checkEqual (a, b) {
// if(a === b) {
// return true;
// }else {
// return false;
// }
//return a === b ? true : false;
return a===b;
}
checkEqual(1,2);
// Use Multiple Conditional (Ternary) Operators
function checkSign (num) {