Skip to content

Commit 7c211e6

Browse files
authored
Merge pull request #1 from ReenaRajani/Changes-part-1
Level 1 and level 1 exercise updates
2 parents 8e86dc7 + 32e5e32 commit 7c211e6

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

js/level1.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
Example:
5959
var hello = 'Hello World';
6060
alert(hello);
61-
It will pop-up alert box with string 'Hello World!'
61+
It will pop-up an alert box with string 'Hello World!'
6262
*/
6363

6464
//TODO: Create 2 variables, 1 with your name and 2nd with your age and display them with alert pop-up box
@@ -71,28 +71,28 @@
7171

7272

7373
/* Arithmetic operators
74-
There is a bunch of different operators in programming. We will look through arithmetical operators now.
74+
There are a bunch of different operators in programming. We will look through arithmetical operators now.
7575
They are standard arithmetical operators (+, -, /, *, etc) that you can use to do math with your numbers.
7676
Example:
7777
var sumOfNumbers = 1 + 3;
7878
alert(sumOfNumbers);
7979
It will pop-up alert box with number 4
8080
*/
8181

82-
//TODO: Create 3 variables, 1st variable named ten with value 10 inside, 2nd variable named three with value 3. And finally 3d variable named multipleOfNumbers that will be equal 1st variable multiply by 2nd variable. And in the end console or alert value of multipleOfNumbers
82+
//TODO: Create 3 variables, 1st variable named ten with value 10 inside, 2nd variable named three with value 3. And finally 3rd variable named multipleOfNumbers that will be equal to 1st variable multiplied by the 2nd variable. And in the end display the value of multipleOfNumbers
8383

8484

8585

8686

8787

8888
/* Functions
8989
Function is a separable, reusable piece of code. Some action that you want to do. It takes some input(arguments), do some manipulation
90-
on it and return the output with key-word 'return'.
90+
on it and returns the output with key-word 'return'.
9191
To create a function you need do following:
9292
var functionName = function(argument){
9393
return argument * 2;
9494
};
95-
So, our function will take 1 argument and return argument multiplied by 2. But for now it will do nothing as we need to call for our function.
95+
So, our function will take 1 argument and return argument multiplied by 2. But for now it will do nothing as we need to call our function.
9696
To call the function we do so:
9797
functionName(10);
9898
Now we will call our function with argument that is 10. And our function will return us 20. To see what our function
@@ -101,7 +101,7 @@
101101

102102
//TODO: It's your turn to create a function.
103103
//Step 1 - Name it 'add' and pass in two argumnets (num1 and num2).
104-
//Step 2 - This function should return us a summ of num1 and num2.
104+
//Step 2 - This function should return us a sum of num1 and num2.
105105
//Step 3 - Call the function with numbers 2 and 3. To see result you can alert it or console.log it - to be sure that it works right.
106106

107107

@@ -141,7 +141,7 @@
141141

142142
/*Comparison operators
143143
You remember we were talking about arithmetical operators and that we have different operators in programming, so
144-
here comes time to introduce you comparison operators that we can use to compare values(>, <, <=, =>, ==, !=).
144+
here comes time to introduce you to comparison operators that are used to compare values(>, <, <=, =>, ==, !=).
145145
Most of them you know from math classes in school, some of them can be new for you, so '==' is checking equality, if two values are equal.
146146
'!=' - checks if they are not equal.
147147
PS: Don't mix up '=' and '==' as they have different meaning.

js/level2.js

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//Level2
22

33
/* Arrays
4-
It is ordered list of values. It can keep any number of values inside. And also
4+
It is an ordered list of values. It can keep any number of values inside. And also
55
any type of values - numbers, strings, objects.
66
Example:
77
var animals = ['cat', 'dog', 'horse];
@@ -40,7 +40,7 @@
4040
var secondItem = randomThings[1]; and so on
4141
*/
4242

43-
//TODO: get 3d element from your array favouriteFood and console.log it
43+
//TODO: get 3rd element from your array favouriteFood and console.log it
4444

4545

4646

@@ -52,14 +52,15 @@
5252
We also can replace values inside of the arrays by assigning specific item from
5353
the array to a new value.
5454
Example:
55-
var animals = ['cat', 'dog', 'horse];
55+
var animals = ['cat', 'dog', 'horse'];
5656
//let's replace 'dog' with 'fish'
5757
animals[1] = 'fish';
58-
//now our animals array will be ['cat', 'fish', 'horse]
58+
//now our animals array will be ['cat', 'fish', 'horse']
5959
*/
6060

6161
//TODO: take your array favouriteFood and replace first value with anything else.
6262
//console.log whole array to check
63+
// Dont forget, that index position starts with 0
6364

6465

6566

@@ -71,12 +72,13 @@
7172
If you want to add new value to array you can use property of array named '.push'.
7273
It will add value to the end of the array
7374
Example:
74-
var animals = ['cat', 'dog', 'horse];
75+
var animals = ['cat', 'dog', 'horse'];
7576
animals.push('rabbit');
77+
so now our array will be ['cat', 'dog', 'horse','rabbit']
7678
*/
7779

7880
//TODO: let's extend your list of favouriteFood and add one more value in it.
79-
//console.log list of your food o check
81+
//console.log list of your favouriteFood and check
8082

8183

8284

@@ -86,17 +88,19 @@
8688

8789

8890
/* Loops
89-
People always have been lazy and it was moving progress forward. We don't like repeat
90-
same boring actions again and again, so we are looking for the way how to improve it.
91+
People always have been lazy and it was moving progress forward. We don't like to repeat
92+
same boring actions again and again, so we are looking for ways how to improve it.
9193
Programming is the same - for example, if I want to print 'JavaScript is awesome!' 10
9294
times what are my options? Of course, I can print 10 lines of code repeating same
93-
phrase over and over again, but I also can tell computer to do it instead of me.
94-
To do it we have loops.
95+
phrase over and over again, but I also can tell computer to repeat it instead of me.
96+
For this we have loops.
9597
Each loop should have 3 main things:
9698
- starting point
9799
- condition (finishing point)
98100
- counter (a step)
99101
If you miss one of them you can get into infinite loop!!!
102+
103+
Let's look into different looping structures
100104
*/
101105

102106

@@ -129,7 +133,7 @@
129133
PS: i++ is a short from 'i = i + 1'
130134
*/
131135

132-
//TODO: now, let's print every 3d number from 3 to 22 using 'for loop'
136+
//TODO: now, let's print every 3rd number from 3 to 22 using 'for loop'
133137

134138

135139

@@ -175,8 +179,8 @@
175179
*/
176180

177181
//TODO: Time has come for a classic exercise - 'FizzBuzz'. Count from 1 to 50 and print
178-
// numbers out. If number multiple of 3 print 'Fizz', if multiple of 5 - 'Buzz', if
179-
// it is multiple of 3 and 5 - 'FizzBuzz'.
182+
// numbers out. If number is a multiple of 3 print 'Fizz', if its a multiple of 5 print 'Buzz', if
183+
// it is multiple of 3 and 5 print 'FizzBuzz', for everthing else print the number itself.
180184
//PS: you can use arithmetic operator modulo (%) - it is remainder when dividing.
181185
//10 % 3 = 1 - so in 10 we have 3*3 + 1
182186
//16 % 4 = 0 - as in 16 we have 4*4

0 commit comments

Comments
 (0)