-
Notifications
You must be signed in to change notification settings - Fork 10
homeworkWeek6 #10
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
Open
cuilhan
wants to merge
2
commits into
hackyourfuturecanada:Umit-Ilhan
Choose a base branch
from
cuilhan:master
base: Umit-Ilhan
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
homeworkWeek6 #10
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| // Q1 - Write a console.log statement saying "Hello World!" for each language that you know. | ||
| console.log("Merhaba Dunya"); // Turkish | ||
| console.log("Salam Dunya"); // Azerbaijani | ||
| console.log("Witaj świecie"); //Polish | ||
|
|
||
| // Q2 - Consider the following code: console.log('I'm awesome'); | ||
| console.log("I'm awesome"); | ||
|
|
||
| // Q3 - Declare a variable age and initialize it with an integer, using these exact steps: | ||
| let myAge; // i | ||
| console.log("the value of age will be: 32"); // ii | ||
| console.log(myAge); // iii | ||
| myAge = 32; // iv | ||
| console.log("the value of age is " + myAge); // v | ||
| console.log(myAge); // vi | ||
|
|
||
| // Q4 - Declare a variable name and assign a string to it. | ||
| let newVar = "lemon"; | ||
| console.log("the value of my string will be: lime"); // i | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mistake here? |
||
| console.log(newVar); // ii | ||
| newVar = "lime"; // iii | ||
| console.log("the value of my string is " + newVar); // iv | ||
| console.log(newVar); // v | ||
|
|
||
| // Q5 - How do you round the number 7.25, to the nearest integer (i.e., whole number)? | ||
| let number = 7.25; // i | ||
| console.log(number); // ii | ||
| let roundedNumber=Math.round(number);// iii | ||
| console.log(roundedNumber);// iV | ||
| if(number > roundedNumber){ // v | ||
| highestValue = number; | ||
| } else if(number == roundedNumber){ | ||
| console.log("number and rounded number is equal"); | ||
| } else { | ||
| highestValue = roundedNumber; | ||
| } | ||
| console.log(highestValue); // vi | ||
|
|
||
| // Q6 - Arrays | ||
| let cities = []; // i | ||
| console.log("My favorite cities: 'Denizli', 'Toronto', 'Dubai'."); // ii | ||
| console.log(cities); // iii | ||
| let myFavoriteAnimals = ["Dog", "Cat", "Shark"]; // iv | ||
| console.log(myFavoriteAnimals); // v | ||
| myFavoriteAnimals.push("Kitten"); // vi | ||
| console.log(myFavoriteAnimals); // vii | ||
|
|
||
| // Q7 - More strings: Let's consider the following string: let myString = "this is a test". | ||
| let myString = "this is a test"; | ||
| console.log(myString); // i | ||
| let lengthMyString = myString.length; // ii | ||
| console.log(lengthMyString); // iii | ||
|
|
||
| // Q8 - If x equals 7, and the only other statement is x = x % 3, what would be the new value of x? | ||
| let x = 7; | ||
| x = x % 3; | ||
| console.log(x); // i | ||
|
|
||
| let y = 35; | ||
| y = y % 6; | ||
| console.log(y); // ii | ||
|
|
||
| let z = 83; | ||
| z = z % 9; | ||
| console.log(z); // iii | ||
|
|
||
| // Q9 - Write a program to answer the following questions: | ||
|
|
||
| let datas = ["umit", 32 , "dog", 5]; // i | ||
| console.log(datas); | ||
| let compare = (6/0) === (10/0); | ||
| console.log(compare); // ii | ||
| console.log("6/0 equal infinite and 10/0 equal infinite. infinite equal infinite."); // iii | ||
|
|
||
| // Q10 - I’ve declared a multidimensional array (an array inside an array) -- see below. How can I access the third item’s second element? i.e. [2, 1] is the third element, and I want to access 1. Add a console.log statement accessing this item. | ||
| const grid = [[0, 1], [1, 1], [2, 1], [3, 1]]; | ||
| console.log(grid[2][1]); | ||
|
|
||
| // Q11 - If I have a variable counter, and I want to increment it by 2, what are three ways I can do this? Add three console.log statements with the three different ways. | ||
| let counter = 0; | ||
| console.log("first method"); | ||
| console.log(counter + 2); | ||
|
|
||
| console.log("second method"); | ||
| counter += 2; | ||
| console.log(counter); | ||
|
|
||
| console.log("third method"); | ||
| counter = counter + 2; | ||
| console.log(counter); | ||
|
|
||
| // Q12 - Here’s a profile about a cat for adoption. Create variables to hold information about this cat as shown on the profile. For example: | ||
| const name = 'Prince'; | ||
| const bestFriend = 'Thomas'; | ||
| const breed ='Domestik Shorthair'; | ||
| const color ='Orange or Red Tabby'; | ||
| const age = '1 year old'; | ||
| const sex = 'Male'; | ||
| const hair ='Short'; | ||
| const info=['Neutered', 'Good with Kids', 'Shots Up to Date', 'Good with Cats']; | ||
| const myStory=['facebook', 'twitter', 'pinterest', 'email']; | ||
| const date='july 28,2018'; | ||
|
|
||
| // Q13 - 13. Create two variables -- one to hold the names of the kittens and one to hold the names of the adult cats. Make sure to choose an appropriate data type to hold this information! | ||
| let kittens=['Kyle Meowry', 'Luna', 'Obi','Charlie', 'Raspberries']; | ||
| let adults=['Mezzo', 'Sabrina', 'josie']; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the instructions were not clear. This step was asking you what you thought the value of age was from line 10, before you initialized it.