diff --git a/HOME.html b/HOME.html new file mode 100644 index 0000000..35aaaa6 --- /dev/null +++ b/HOME.html @@ -0,0 +1,13 @@ + + +
+Me i need to sleep (Zzzzz)
+My pair was so cool , we had so match fun and solve the most of the questions
\ No newline at end of file diff --git a/closestMultipleOf10.js b/closestMultipleOf10.js new file mode 100644 index 0000000..c456e44 --- /dev/null +++ b/closestMultipleOf10.js @@ -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 ,"
+
+
+
+
+
\ No newline at end of file
diff --git a/htmlExample.js b/htmlExample.js
new file mode 100644
index 0000000..64faad8
--- /dev/null
+++ b/htmlExample.js
@@ -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
+
+*/
diff --git a/strings.js b/strings.js
new file mode 100644
index 0000000..3356527
--- /dev/null
+++ b/strings.js
@@ -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)
+ }
\ No newline at end of file
diff --git a/strings2.js b/strings2.js
new file mode 100644
index 0000000..70a0c54
--- /dev/null
+++ b/strings2.js
@@ -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 +""
+ }
\ No newline at end of file
diff --git a/swap.js b/swap.js
new file mode 100644
index 0000000..3bc3f1b
--- /dev/null
+++ b/swap.js
@@ -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
+
+ }
\ No newline at end of file