diff --git a/Week2/%.js b/Week2/%.js new file mode 100644 index 000000000..7f979a060 --- /dev/null +++ b/Week2/%.js @@ -0,0 +1,8 @@ +// Explaining % + +x = 12; +console.log(x); + +console.log ('x % 5 will be 2 which is the leftover number that cannot be divided on 5'); + +console.log(x % 5); \ No newline at end of file diff --git a/Week2/arrays.js b/Week2/arrays.js new file mode 100644 index 000000000..7fbd5ee8a --- /dev/null +++ b/Week2/arrays.js @@ -0,0 +1,15 @@ +// Animals Names + +let myFavoriteAnimals; + +console.log('The value of myFavoriteAnimals is: undefined then an object \'array\' '); + +console.log(myFavoriteAnimals); + +myFavoriteAnimals = ['monkey', 'horse', 'turtle']; + +console.log(myFavoriteAnimals); + +myFavoriteAnimals = myFavoriteAnimals + [', baby pig']; + +console.log(myFavoriteAnimals); \ No newline at end of file diff --git a/Week2/dataType.js b/Week2/dataType.js new file mode 100644 index 000000000..104649d32 --- /dev/null +++ b/Week2/dataType.js @@ -0,0 +1,61 @@ +// Types of Data + +let success = 'Congats! the data type of your variables is identical!'; + +console.log(success + ' * this is a string'); + +console.log(typeof success); + + +let failure = 'Oops! the data type of your variables is different!'; + +console.log(failure + ' * this is a string'); + +console.log(typeof failure); + + +let number = 1; + +console.log(number + ' * this is a number'); + +console.log(typeof number); + + +let boolean = true; + +console.log(boolean + ' * this is a boolean'); + +console.log(typeof boolean); + + +let array = [0, 1, 2, 3, 4]; + +console.log(array + ' * this is an object'); + +console.log(typeof array); + +// Testing type of data + +if (typeof success === typeof failure) { + + console.log(success); + +} else { + console.log(failure); +} + + +if (typeof success === typeof number) { + console.log(success); + +} else { + console.log(failure); +} + + +if (typeof boolean === typeof array) { + console.log(success); + +} else { + console.log(failure); +} diff --git a/Week2/helloWorld.js b/Week2/helloWorld.js new file mode 100644 index 000000000..8fe96f56f --- /dev/null +++ b/Week2/helloWorld.js @@ -0,0 +1,11 @@ +// Greetings + +console.log ('Hello World!'); //English + +console.log ('Halo, Dunia!'); // Indonesian + +console.log ('Ciao Mondo!'); // Italian + +console.log ('Hola Mundo!'); // Spanish + + diff --git a/Week2/imAwesome.js b/Week2/imAwesome.js new file mode 100644 index 000000000..520fbbda3 --- /dev/null +++ b/Week2/imAwesome.js @@ -0,0 +1,17 @@ +// Debug single quote issue + +console.log('I\'m awesome'); + +// variables & Values + +let x; + +console.log("the value of my variable x will be: undefined "); + +console.log(x); + +x = 12; + +console.log("the value of my variable x will be: a number 12 "); + +console.log(x); \ No newline at end of file diff --git a/Week2/index.html b/Week2/index.html new file mode 100644 index 000000000..567877d9f --- /dev/null +++ b/Week2/index.html @@ -0,0 +1,30 @@ + + +
+ + + +