Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit cd8ff34

Browse files
committed
JS 1 HW Week 2
1 parent b73726d commit cd8ff34

11 files changed

Lines changed: 28 additions & 16 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

week4:JSweek2/.DS_Store

100644100755
File mode changed.

week4:JSweek2/1.js

100644100755
File mode changed.

week4:JSweek2/2.js

100644100755
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
var Imawesome = 'I`m awesome';
2-
3-
console.log(Imawesome);
1+
console.log(`I'm awesome`);
42

53
/*
64
console.log('I'm awesome');

week4:JSweek2/3.js

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var x
2-
console.log("the value of my variable x will be: five");
1+
2+
console.log("the value of my variable x will be: 5");
33
var x = (5);
44
console.log(x);

week4:JSweek2/4.js

100644100755
File mode changed.

week4:JSweek2/5.js

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var z = '7.25';
1+
var z = 7.25;
22
console.log(z);
3-
var a = Math.ceil(7.25);
3+
var a = Math.round(z);
44
console.log(a);
5-
console.log(Math.max(z, a ));
5+
console.log(Math.max(z, a));

week4:JSweek2/6.js

100644100755
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
let arr = [ ];
1+
let myFavouriteAnimals = [ ];
22
console.log("the value of my array will be: undefined");
3-
console.log(arr[0]);
4-
arr = ['parrot', 'fish', 'dog'];
5-
console.log(arr[2]);
6-
arr.push('baby pig');
7-
console.log(arr[3]);
3+
console.log(myFavouriteAnimals);
4+
myFavouriteAnimals = ['parrot', 'fish', 'dog'];
5+
console.log(myFavouriteAnimals);
6+
myFavouriteAnimals.push('baby pig');
7+
console.log(myFavouriteAnimals);
8+
9+
/* 6. Arrays
10+
6.1 Declare an empty array. Make sure that the name you choose indicates 'plurality', because an array is capable of containing more than one element. (See Naming conventions).
11+
6.2 Write a console.log statement that explains in words what you think the value of the array is.
12+
6.3 console.log your array.
13+
6.4 Create an array that has your favorite animals inside (see if you can find a good name that exactly describes what this variable will hold).
14+
6.5 Log your array.
15+
6.6 Add a statement that adds Daan's favorite animal ('baby pig') to the existing array.
16+
6.7 Log your new array! */

week4:JSweek2/7.js

100644100755
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
let myString = "this is a test";
22
console.log(myString);
3-
'myString'.length;
4-
console.log(myString.length);
3+
console.log(myString.length);
4+
5+
/* 7. More strings
6+
Let's consider the following string: let myString = "this is a test".
7+
7.1 Add the string to your file and console.log it.
8+
7.2 Find a way to get the length of myString.
9+
7.3 console.log the length of myString. */

week4:JSweek2/app.js

100644100755
File mode changed.

0 commit comments

Comments
 (0)