Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Example steps for question 4:

2. console.log number.

3. Declare another variable roundedNumber that has the value of z but rounded to the nearest integer.
3. Declare another variable roundedNumber that has the value of number but rounded to the nearest integer.

4. console.log number.

Expand Down
131 changes: 131 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// Question 1
console.log ("Hello World!")
console.log ("Merhaba Dunya!")

// Question 2
console.log ("I'm awesome")

//Question 3
//i
let age

//ii
console.log ("The value of age will be:Undefined")

//iii
console.log(age)

//iv
age=34

//v
console.log("The value of age will be:34")

//vi
console.log(age)

//Question 4
let name = "Kursad"

//i
console.log("the value of my string will be:Kursad")

//ii
console.log(name)

//iii
name = "Begum"

//iv
console.log("the value of my string will be:Kursad")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you copied this console.log statement from line 31, but look at line 37 for the new value of name.


//v
console.log(name)

//Question 5
//i
let roundThenumber = 7.25

//ii
console.log(roundThenumber)

//iii
let roundedNumber = Math.floor(roundThenumber)

//iv
let highest
if (roundedNumber>roundThenumber) {
highest = roundedNumber
} else {
highest = roundThenumber
}

//v
console.log(highest)

//Question 6
//i
let things = []

//ii
console.log("the value of my array will be an emty array")

//iii
let favoriteAnimals = ["cat","dog","wolf"]

//iv
console.log(favoriteAnimals)

//vi
favoriteAnimals.push("kitten")

//vii
console.log(favoriteAnimals)

//Question 7
//i
let myString = "this is a test"

//ii
lengthOfmyString = myString.length

//iii
console.log(lengthOfmyString)

//Question 8
let x = 7
console.log(x)
x=x%3
console.log("the value of x will be 1, because % is a remainder operator")
console.log(x)

//Question 9
//i
let differentTypearray = ["kursad",34]

//ii
console.log(6/0 === 10/0)

//Question 10
const grid = [[0, 1], [1, 1], [2, 1], [3, 1]];
console.log(grid[2][0])

//Question 11
let counter = 0
console.log(counter+=2)
console.log(counter = counter +2)
console.log(counter++)
console.log(++counter)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job using the prefix increment operator here to show the result!


//Question 12
const name = "Prince"
const bestFriend = "Thomas"
const breed = "Domestic Shorthair"
const color = "Orange and Red Tabby"
let age = 1
const sex = "male"
let hair = "short"

//Question 13
namesKittens = ["Kyle Meowry","Luna","Obi","Charlie","Raspberries"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, but make sure to use let or const to declare your array variables.

namesAdults = ["Mezzo", "Sabrina", "Josie"]