-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 939b7c0
Showing
7 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
let seasons = { | ||
winter : ["January", "December", "February"], | ||
spring : ["March", "April", "May"], | ||
summer :["June", "July", "August"], | ||
autumn : ["September", "October", "November"], | ||
|
||
} | ||
|
||
let month = "September" | ||
|
||
for (const key in seasons) { | ||
if (seasons[key].indexOf(month) != -1) { | ||
console.log("The Season is :", key); | ||
} | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
var users = { | ||
Alex: { | ||
email: '[email protected]', | ||
skills: ['HTML', 'CSS', 'JavaScript'], | ||
age: 20, | ||
isLoggedIn: false, | ||
points: 30 | ||
}, | ||
Asab: { | ||
email: '[email protected]', | ||
skills: ['HTML', 'CSS', 'JavaScript', 'Redux', 'MongoDB', 'Express', 'React', 'Node'], | ||
age: 25, | ||
isLoggedIn: false, | ||
points: 50 | ||
}, | ||
Brook: { | ||
email: '[email protected]', | ||
skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux'], | ||
age: 30, | ||
isLoggedIn: true, | ||
points: 50 | ||
}, | ||
Daniel: { | ||
email: '[email protected]', | ||
skills: ['HTML', 'CSS', 'JavaScript', 'Python'], | ||
age: 20, | ||
isLoggedIn: false, | ||
points: 40 | ||
}, | ||
John: { | ||
email: '[email protected]', | ||
skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux', 'Node.js'], | ||
age: 20, | ||
isLoggedIn: true, | ||
points: 50 | ||
}, | ||
Thomas: { | ||
email: '[email protected]', | ||
skills: ['HTML', 'CSS', 'JavaScript', 'React'], | ||
age: 20, | ||
isLoggedIn: false, | ||
points: 40 | ||
}, | ||
Paul: { | ||
email: '[email protected]', | ||
skills: ['HTML', 'CSS', 'JavaScript', 'MongoDB', 'Express', 'React', 'Node'], | ||
age: 20, | ||
isLoggedIn: false, | ||
points: 40 | ||
} | ||
} | ||
|
||
// Solution 1 | ||
let MostSkilled = { | ||
key : "Alex", | ||
numSkills: users["Alex"].skills.length | ||
} | ||
|
||
for (const key in users) { | ||
if (users[key].skills.length > MostSkilled["numSkills"]) { | ||
MostSkilled = { | ||
key : key, | ||
numSkills: users[key].skills.length | ||
} | ||
} | ||
} | ||
|
||
console.log(MostSkilled["key"], users[MostSkilled["key"]]); | ||
|
||
// Solution 2 | ||
// let MostSkilled = users["Alex"] | ||
|
||
// for (const key in users) { | ||
// if (users[key].skills.length > MostSkilled.skills.length ) { | ||
// MostSkilled = users[key] | ||
// } | ||
// } | ||
|
||
// console.log(MostSkilled); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("$" + (+(prompt("Enter The price"))).toFixed(2)); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let arr =[4, 6, 9, "Hello", 8, "a", "0", "b"] | ||
let val = prompt("Give me the value you want to search.") | ||
|
||
if (arr.indexOf(+(val)) != -1 || arr.indexOf(val) != -1 ) { | ||
console.log(val, "Is in the array."); | ||
} else { | ||
console.log(val, "is not in the array."); | ||
} |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let num = "493193" | ||
let bigNum = num | ||
|
||
let sum; | ||
|
||
while (num.length > 1) { | ||
sum = 0; | ||
for (let index = 0; index < num.length; index++) { | ||
sum += +(num[index]); | ||
} | ||
num = sum.toString() | ||
|
||
} | ||
|
||
console.log("The Digital Root of", bigNum, "is :", num) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
|
||
let flinker = [ | ||
{ | ||
title : "Me at the Beach", | ||
caption: "Having fun with my firends at the beach", | ||
photo: "beachPhotos/img1.png", | ||
likes : ["Alex", "Recim", "Paul"] | ||
}, | ||
{ | ||
title : "What a day at my grandma house", | ||
caption: "Why don't people see their grandparents so often ? it is so cool", | ||
photo: "grandMaPhotos/img2.png", | ||
likes : ["Alex", "Recim", "Paul", "Tarek", "Chemsou"] | ||
} | ||
] |