Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
527cc09
init
Feb 19, 2018
e0fb819
Merge branch 'master' of https://github.com/rbk-org/Toy_Problems
QaysTrad Feb 20, 2018
ee7cec6
QT Oop
QaysTrad Feb 20, 2018
1885c6e
init
Feb 20, 2018
03686da
Merge branch 'master' of https://github.com/rbk-org/Toy_Problems
QaysTrad Feb 21, 2018
8487a50
QT Html test
QaysTrad Feb 21, 2018
5a5bc60
QT HTML
QaysTrad Feb 21, 2018
e355dc2
test
Feb 22, 2018
02137a8
remove
Feb 22, 2018
1923f9f
init
Feb 25, 2018
1cc5f43
Merge branch 'master' of https://github.com/rbk-org/Toy_Problems
QaysTrad Feb 25, 2018
5186b24
QT string
QaysTrad Feb 25, 2018
16a5923
delted image folder
QaysTrad Feb 25, 2018
6b7a058
Merge pull request #328 from QaysTrad/master
Fatima90 Feb 25, 2018
7db2f0e
init
Feb 26, 2018
59acbd4
Merge branch 'master' of https://github.com/rbk-org/Toy_Problems
QaysTrad Feb 26, 2018
9d5d8f6
QT str2
QaysTrad Feb 26, 2018
c6d5e5e
Merge pull request #339 from QaysTrad/master
Fatima90 Feb 26, 2018
a06420f
init
Feb 26, 2018
093a1a7
Merge branch 'master' of https://github.com/rbk-org/Toy_Problems
QaysTrad Feb 27, 2018
5685410
QT accum
QaysTrad Feb 27, 2018
f347da1
init
Feb 28, 2018
f32d635
Merge branch 'master' of https://github.com/rbk-org/Toy_Problems
QaysTrad Feb 28, 2018
9e618e6
QT Swap
QaysTrad Feb 28, 2018
bd80aab
Merge pull request #377 from QaysTrad/master
Fatima90 Feb 28, 2018
1f4b70c
init
Mar 1, 2018
2ff8740
Merge branch 'master' of https://github.com/rbk-org/Toy_Problems
QaysTrad Mar 1, 2018
7349657
QT the Closest
QaysTrad Mar 1, 2018
4c79d01
Merge pull request #451 from QaysTrad/master
Fatima90 Mar 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions HOME.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Toy Problem</title>
</head>
<body><br>
<a href="bio.html">The Bio</a><br>

<a href="Movies.html">The Movies</a><br>

<a href="favorite.html">The Favorite</a><br>
</body>
</html>
16 changes: 13 additions & 3 deletions HigherFunctionsEach2.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ pName(x); = > ['Jon', 'Omar', 'salwa']
}

function pName(argument) {
// your code is here
}
var allNames = {}
each(argument , function (argument,i) {
if(i %2 === 0 ){
allNames[i] = argument["name"]
}
})
return allNames ;
}


/*
Expand Down Expand Up @@ -44,5 +50,9 @@ printValue(obj_1); =>


function printValue(obj) {
// your code is here
var newArr = ""
each(obj , function (obj , key ) {
newArr += obj + "\n"
})
return newArr
}
20 changes: 20 additions & 0 deletions Movies.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>Movies</title>
</head>
<body>
<ol>
<li>Jordan</li>
<li>Canda</li>
<li>UAE</li>

</ol>
<ul>
<li>DeadPool</li>
<li>Show shank redmtion</li>
<li>The Mask</li>
<li>The avengers</li>
</ul>
</body>
</html>
38 changes: 38 additions & 0 deletions Oop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// We have this code from Adding Methods With Closures lecture:
// Refactor the code as an MakeGame class that shares its methods across different instances.


function randInt(n) {
return Math.floor(Math.random() * (n + 1));
}

function makeGame(upperbound){

var game = {}
game.upperbound = upperbound
game.upper = upperbound;
game.rand = randInt(game.upper)
game.counter = 0;

game.guessMyNumber = guessMyNumber ;
game.giveUp = giveUp ;
game.numOfGuesses = numOfGuesses ;

return game
}
function guessMyNumber(n){
this.counter++;
if (n > this.upper) {
return "Out of bounds! Please try a number between 0 and " + this.upperbound + ".";
} else if (n === this.rand) {
return "You guessed my number!";
}
return "Nope! That wasn't it!";
}

function giveUp(){
return this.rand;
}
function numOfGuesses(){
return this.counter;
}
21 changes: 21 additions & 0 deletions accum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// This time no story, no theory. The examples below show you what do you need, write a function to accomplich that
// Examples:
// accum("abcd"); // "A-Bb-Ccc-Dddd"
// accum("RqaEzty"); // "R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy"
// accum("cwAt"); // "C-Ww-Aaa-Tttt"

function accum(input){
//your code is here
var arr = input.split("");
var str = ""
for (var i = 0; i < arr.length; i++) {

str += arr[i].toUpperCase() ;
for (var j = 0; j < i; j++) {
str+=arr[i]
}
str+="-"

}
return str
}
2 changes: 2 additions & 0 deletions bio.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<p>Me i need to sleep (Zzzzz)</p>
<p>My pair was so cool , we had so match fun and solve the most of the questions </p>
25 changes: 25 additions & 0 deletions closestMultipleOf10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Given a number return the closest number to it that is divisible by 10.
// Example :
// 22 ===> 20
// 25 ===> 30
// 37 ===> 40
function closestMultipleOf10(num) {
//your code is here
var newNum = num%10
var str = num +""
if(newNum <=5){
str = str[0] + "0"
str = parseInt(str ,"<br>")
return str
}
else{
str = parseInt(str[0] ,"<br>")

str +=1
str+=""
str = str[0] + "0"
str = parseInt(str ,"<br>")
return str
}

}
15 changes: 15 additions & 0 deletions favorite.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>DeadPool</h1>
<img src="Images/image1.jpg">
<h1>DarkSiders</h1>
<img src="Images/image2.jpg">
<h1>Ezeo Al detori</h1>
<img src="Images/image3.jpg">
<h1>The Flag</h1>
<img src="Images/image4.jpg">
</body>
</html>
17 changes: 17 additions & 0 deletions htmlExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
1) create HTML web-page HOME.html then set the title to Toy Problem
2) create another web-page favorite.html then add your five favorite picture
3) create web-page Movie.html that includes an order list for your favorite 3 countries and an unordered
list for your best five movies
4) create web-page bio.html and add two paragraphs about you and your pair.
5) if you finished the above, can you link these pages toghter?

home.html
/|\
/ | favorite.html
/ |
/ Movie.html
/
bio.html

*/
26 changes: 26 additions & 0 deletions strings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Write a function called characPosit, when provided with a letter, return its position in the alphabet.
// Input :: "a"
// Ouput :: "Position of alphabet: 1"
function characPosit(character){
//your code is here
var newChar = character.toLowerCase();
var arr = ["a" , "b" , "c" , "d" , "e" , "f" ,"g" , "h" , "i" , "j" , "k" , "l" , "m" , "n" ,"o" ,"p" , "q" , "r" , "s" , "t" , "v" , "w" , "x" , "y" , "z"]

for (var i = 0; i < arr.length; i++) {
if(arr[i] === newChar){
return i+1
}
}
}

// Write a function called repeatStr which repeats the given
// string string exactly n times.
// repeatStr("hello",4) ==> 'hellohellohellohello'

function repeatStr(n, s) {
//your code is here
if (s === 0) {
return ""
}
return n + repeatStr(n,s-1)
}
24 changes: 24 additions & 0 deletions strings2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Given a sequence of items and a specific item in that sequence, return the item
// immediately following the item specified. If the item occurs more than once in a sequence,
// return the item after the first occurence. This should work for a sequence of any type.
// When the item isn't present or nothing follows it, the function should return null
// nextItem([1, 2, 3, 4, 5, 6, 7], 3) # 4
// nextItem("testing", "t") # "e"

function nextItem(items, elem){
//your code is here
for (var i = 0; i < items.length; i++) {
if(items[i] === elem){
return items[i+1]
}
}
}
// We need a function that can transform a number into a string.
// What ways of achieving this do you know?
// numberToString(123); // returns '123';`
// numberToString(999); // returns '999';`

function numberToString(num) {
//your code is here
return num +""
}
18 changes: 18 additions & 0 deletions swap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Given a string, swap the case for each of the letters.
// IbrAHiM --> iBRahIm
// ToYPRoblEm --> tOyprOBLeM
function swap(input){
//your code is here
var newstr = ""
for (var i = 0; i < input.length; i++) {

if(input[i] === input[i].toLowerCase()){
newstr+=input[i].toUpperCase()
}
else if(input[i] === input[i].toUpperCase()){
newstr+=input[i].toLowerCase()
}
}
return newstr

}