Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dhia Fattoum #17

Open
wants to merge 56 commits into
base: Dhia-Fattoum
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
fde3426
done
Dhia-Fattoum Mar 13, 2020
9a3bc1a
warmUp2
Seif-Miehiar Mar 14, 2020
b6d9181
updated
Seif-Miehiar Mar 14, 2020
128121d
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Dhia-Fattoum Mar 14, 2020
2a365d5
done
Dhia-Fattoum Mar 14, 2020
87d1ed2
warmUp3 is pushed
Seif-Miehiar Mar 16, 2020
5e47cf8
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Skander-benRomdhane Mar 16, 2020
1a08710
:(
Skander-benRomdhane Mar 16, 2020
94004fe
done
Dhia-Fattoum Mar 16, 2020
4ab3967
warmUp 4
Seif-Miehiar Mar 16, 2020
0102ca2
yes
Dhia-Fattoum Mar 17, 2020
84c41d2
done
Dhia-Fattoum Mar 17, 2020
b0ec828
warmUp5
Seif-Miehiar Mar 18, 2020
bb8f600
warmup5
Seif-Miehiar Mar 18, 2020
4072b54
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Dhia-Fattoum Mar 18, 2020
dbdb078
okay
Dhia-Fattoum Mar 18, 2020
7e2c034
warmUp 5✔
Hashem-Buzer Mar 18, 2020
1623af4
okay
Dhia-Fattoum Mar 18, 2020
a920a38
warm up5
Dhia-Fattoum Mar 18, 2020
a293eee
warmUp6
Seif-Miehiar Mar 18, 2020
8b5ecdb
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Hashem-Buzer Mar 19, 2020
51c46a5
done
Dhia-Fattoum Mar 19, 2020
49a776a
warmUp7
Seif-Miehiar Mar 19, 2020
83d2003
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Hashem-Buzer Mar 20, 2020
33c87b6
solved
Hashem-Buzer Mar 20, 2020
e30243f
warmUp7 is solved
Hashem-Buzer Mar 20, 2020
0cd2b33
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Dhia-Fattoum Mar 20, 2020
be28325
fin
Dhia-Fattoum Mar 20, 2020
69e466b
warmUp 8
Seif-Miehiar Mar 21, 2020
11f895e
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Hashem-Buzer Mar 21, 2020
34cad94
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Dhia-Fattoum Mar 21, 2020
943001a
warmUp8 ✔
Hashem-Buzer Mar 21, 2020
688273d
warmUp 9
Seif-Miehiar Mar 22, 2020
96c5545
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Dhia-Fattoum Mar 23, 2020
6c83c81
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Hashem-Buzer Mar 23, 2020
0c50957
yo
Dhia-Fattoum Mar 23, 2020
a681610
warmUp9 ✔
Hashem-Buzer Mar 23, 2020
0e47aea
warmUp 10
Seif-Miehiar Mar 23, 2020
6aa3693
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Dhia-Fattoum Mar 24, 2020
d4e34df
ui
Dhia-Fattoum Mar 24, 2020
651ca42
test the pull request
Hashem-Buzer Mar 24, 2020
2e45991
warmUp11
Hashem-Buzer Mar 25, 2020
e462924
Update warmUp5.js
Houda-Rouaissi Mar 25, 2020
1e0ee78
Update warmUp8.js
Houda-Rouaissi Mar 25, 2020
542e878
Update warmUp4.js
Houda-Rouaissi Mar 25, 2020
aeafcae
Update warmUp7.js
Houda-Rouaissi Mar 25, 2020
653380f
Update warmUp9.js
Houda-Rouaissi Mar 25, 2020
eedf4d1
warmUp 6
Houda-Rouaissi Mar 25, 2020
1df7137
yalla
Dhia-Fattoum Mar 25, 2020
61b0662
warmUp12
mohamed-Dhia Mar 26, 2020
b5a52cd
kk
Dhia-Fattoum Mar 26, 2020
344f789
warmUp 13
Seif-Miehiar Mar 27, 2020
2a41df3
yo
Dhia-Fattoum Mar 27, 2020
f7116e6
warmUp 14
Seif-Miehiar Mar 28, 2020
38377aa
Merge branch 'master' of https://github.com/RBK-RebootKampTunisiaCoho…
Dhia-Fattoum Mar 28, 2020
e709932
ff
Dhia-Fattoum Mar 28, 2020
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
1 change: 1 addition & 0 deletions rbktn03-recursion-extra-material
Submodule rbktn03-recursion-extra-material added at 704e1a
37 changes: 37 additions & 0 deletions warmUp10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Style your code and explain it step by step before jumping to code :D
// Read carefully, focus and test your code :) ... /\ HaPPy HaCkInG /\

// **************** git status ****************
// **************** git add fileName.js ****************
// **************** git status ****************
// **************** git commit -m "your message" ****************
// **************** git status ****************
// **************** git push origin master ****************

// 1- Using recursion Write a JavaScript program to find the greatest common divisor (gcd) of two positive numbers.

// **************** git status ****************
// **************** git add fileName.js ****************
// **************** git status ****************
// **************** git commit -m "your message" ****************
// **************** git status ****************
// **************** git push origin master ****************

// 2-Write a function called sum that accepts two numbers as parameters, and sum them together but without suming them togther directly
//you can only add one at each summetion, you'll need to use recursion in this.
function sum (x,y) {
if ( x === y ) {
return x;
}
else if (x>y){
return sum(y,x);
}
else {
return x + sum (x,y-1)
}
// **************** git status ****************
// **************** git add fileName.js ****************
// **************** git status ****************
// **************** git commit -m "your message" ****************
// **************** git status ****************
// **************** git push origin master ****************
15 changes: 15 additions & 0 deletions warmUp11.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 1-Create arrays in the global scope consisting of strings that represent:
var arrays = {
nameOfFemales : 'mariem',
nameOfMales : "Firas",
nameOfYourClassInstructors : "insaf",
};
// -name of females in your class
// -name of males in your class
// -name of your class instructors

// 2-write a function that takes an array as an argument and returns the element that is located in the middle of that array.
function middle (arr) {
return arr[1] ;
}
// 3-Change all the numbers in the array to be multiplied by two for even indexes.
6 changes: 6 additions & 0 deletions warmUp12.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// 1-Write a function that takes a string as an input and returns the reverse of each letter
//followed by a number starting from zero(solve it using while loop).
// example: reverseStr('hello'); "o0l1l2e3h4"

// 2-write a function that takes array of strings and returns an array of the strings that have the same length
// example : ['hi','hello','welcome','hy'] == > ["hi","hy"]
19 changes: 19 additions & 0 deletions warmUp13.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Style your code and explain it step by step before jumping to code :D
// Read carefully, focus and test your code :) ... /\ HaPPy HaCkInG /\

// 1-implement the function mult that takes a single parameter n, and computes the multiplication of all integers up to n
//starting from 0, e.g.:
// mult(3); // => 6
// mult(4); // => 24
function mult (n) {
var x=1;
while ( n > 0){
x=x*n;
n=n-1;
}
return x;
}
// 2- Use a while loop to build a single string with the numbers 1 through n
// separated by the number next to the current number.
//Have it return the new string.
// eg= 1 2 2 3 3 4 4 5 5 6 6 ...
17 changes: 17 additions & 0 deletions warmUp14.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Style your code and explain it step by step before jumping to code :D
// Read carefully, focus and test your code :) ... /\ HaPPy HaCkInG /\

//create a function isSubset that should take two arrays and determine whether the second array is a subset of the first array.
//For example:

// array: [ 1, 2, 3, 4 ], sub:[ 2, 3, 4 ] => true
// array: [ 2, 2, 2, 3, 4 ], sub:[ 2, 4, 3 ] => true
// array: [ 2, 3, 3, "a" ], sub:[ 3, 3, 3, "a" ] => false

function isSubsetOf(set, subset) {
for (i = 0; i < set.length; i++) {

return true;
}
return false;
}
27 changes: 27 additions & 0 deletions warmUp2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 1 - Complete the function cube that returns the cube of x:

function cube(x) {
// your code here
}

// 2 - Write a function sameLength that accepts two strings as arguments, and returns true if those strings have the same length, and false otherwise.

function sameLength(string1, string2) {
// your code here
}

// 3 - Write a function called scoreToGrade that accepts a number as a parameter and returns a string representing a letter grade corresponding to that score.

function scoreToGrade(number) {
// your code here
}
// USE RECURSION
// Repeating a String n Times: Let's write a function called repeatString that takes two parameters: a string str, which is the string to be repeated, and count -- a number representing how many times the string str should be repeated
// repeatString('dog', 0); // => ''
// repeatString('dog', 1); // => 'dog'
// repeatString('dog', 2); // => 'dog' + 'dog' => 'dogdog'
// repeatString('dog', 3); // => 'dog' + 'dog' + 'dog' => 'dogdogdog'

function repeatString(str, count) {
// TODO: your code here
}
19 changes: 19 additions & 0 deletions warmUp3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 1 - Write functions larger and smaller that each accept two strings as arguments, and return the larger and smaller strings, respectively

// 2 - Write a function called counter that, when invoked, always returns a number that is one more than the previous invocation. For instance:
// function counting(n) {
// TODO: your code here
// }
// counting(5); // => '1, 2, 3, 4, 5'
// counting(1); // => '1'
// counting(3); // => '1, 2, 3'

// 3 - Meet & Greet: n numbers are coming to a party for numbers. Introduce them each to all the guests as they arrive. You should end up with output looking something like this one for n = 5
// welcome 1
// welcome 2, meet 1
// welcome 3, meet 1 and 2
// welcome 4, meet 1, 2 and 3
// welcome 5, meet 1, 2, 3 and 4
//

// 4- Write a function shortestWord that works like longestWord, but returns the shortest word instead.
8 changes: 8 additions & 0 deletions warmUp4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// 1-write a function that returns the product of any number by 3.

// 2-complete the following function multiply to return the result of multiplying of x and y

// 3-complete the following function that Convert Fahrenheit to Celsius if the module for converting is
// (5/9) * (fahrenheit-32);

// 4-Define a function named "sqArea", and make it display square area if you knew the length of its side.
33 changes: 33 additions & 0 deletions warmUp5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 1) Write a function named greaterNum that:
// - takes 2 arguments, both numbers.
// - returns whichever number is the greater (higher) number.
// ex greaterNum(5, 10) => "The greater number of 5 and 10 is 10."


// 2) Write a function named isEven using for loop that
// - iterate from x to y.
// - return array contain the even values,
// ex: isEven(1,10) => [2,4,6,8,10]

//3) write a function named sum that
// - Use a while loop to add up the numbers from x to y.
// ex sum(1,5) => 15


//4) Write a function named factorial that
// - Use Recursion to calculate the factorial of a number
// - the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n
// - 5! = 5*4*3*2*1 = 120
// ex : factorial(5) => 120

//5) write a function named decimals
//- the function will format a number up to specified decimal places
//- the function will return a string
//- if the parameters not a number return false
// ex :
// decimals(2100, 'a') ==> false
// decimals('a', 5) ==> false
// decimals(2.100212, 2) ==> '2.10'
// decimals(2.100212, 3) ==> '2.100'
// decimals(2100, 2) ==> '2100.00'
//
28 changes: 28 additions & 0 deletions warmUp6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Style your code and explain it step by step before jumping to code :D
// Read carefully, focus and test your code :) ... /\ HaPPy HaCkInG /\

// 1-Define a function called myTrueFun that returns true whenever its called.
function myTrueFun (){
return true ;
}
// 2- Define a function called color in which returns true if type of the input is string and returns false otherwise.
<<<<<<< HEAD
function color(n){
if ('n'){
return true ;
}
else return false;
}
=======


>>>>>>> eedf4d1da29beb7f6472f832fb846002ed7197b5
// 3-Write a JavaScript function that accepts a number as a parameter and check if the number is prime or not.
function JavaScript (n){
if (n>1 , (n/n) && (n/1)){
return true ;
}
return false ;
}
// 4-write a function that accepts two numbers as parameters and returns true if the two parameters have the same value , false if not

21 changes: 21 additions & 0 deletions warmUp7.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 1-Choose the correct comparison operator to display "true", when: 5 is less than 7.
<<<<<<< HEAD
//answer :
5<7 ;
=======
//answer : 5 < 7 ? true : false;

>>>>>>> eedf4d1da29beb7f6472f832fb846002ed7197b5
//2- Write a function named helloWorld that:
//takes 1 argument, a language code (e.g. "fr", "es", "en")
//returns "Hello, World" for the given language, for atleast 3 languages. It should default to returning English.
//ex: helloWorld('fr') ==> 'Bonjour tout le monde'
// helloWorld('es') ==> 'Hola, Mundo'
// helloWorld('') ==> 'Hello, World'


//3- write a function to Reverse an array without use array.reverse() method:
// ex: reverseArray([1,2,3]) ==> [3,2,1]
function reserveAnArray(){
return reserveAnArray.reverse ;
}
8 changes: 8 additions & 0 deletions warmUp8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// 1 - Write a function named objKey that take an object as a parameter and returns an array containing the keys of the object
// objKey({name:'ahmed',age:20}) ==> ['name','age']

// 2 - Write a function named objLength to get the length of a JavaScript object
// objLength({name:'ahmed',age:20}) ==> 2

// 3 - Write a function named objSort to sort an array of JavaScript objects based on the id
// objSort([{id:2,value:50},{id:0,value:70},{id:1,value:40}]) ==> [{id:0,value:70},{id:1,value:40},{id:2,value:50}]
38 changes: 38 additions & 0 deletions warmUp9.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Style your code and explain it step by step before jumping to code :D
// Read carefully, focus and test your code :) ... /\ HaPPy HaCkInG /\

//1. Write a JavaScript function to check whether an `input` is an array or not
// ex isArray([1,2])=>true
// isArray(5)=>false
function JavaScript (input){
var = n
if (input == [n]) {
return true;
}
return false
}
//2-Write a JavaScript function to get the first n element of an array.
//ex first([1,2,3],1)=>[1]
// first([1,2,3,4]2)=>[1,2]


var first = (array, n) => {
if (array == 0)
return 0;
if (n == 0)
return array[0];
if (n < 0)
return [];
return array.slice(0, n);
};

//3- Write a JavaScript function to convert an object into a list of `[key, value]` pairs
//ex: convert({name:'ahmed',age:20})=>[['name','ahmed'],['age', 20]]

// **************** git status ****************
// **************** git add fileName.js ****************
// **************** git status ****************
// **************** git commit -m "your message" ****************
// **************** git status ****************
// **************** git push origin master ****************
i need an extra love session about the object and thnx <3