This repository was archived by the owner on Jan 14, 2024. It is now read-only.
LONDON-9-SAGHAR HOSSEINMARDI-JS-WEEK3 - #201
Open
SagharHosseinmardi wants to merge 4 commits into
Open
Conversation
jonnywyatt
reviewed
Dec 10, 2022
There was a problem hiding this comment.
Brilliant Saghar!
When rendering a string with embedded variables, have a look at template strings and see if you prefer the syntax (or not)
| let hello = sayHello(); | ||
| console.log(hello); | ||
|
|
||
| // the function doesn't return anything and there is no value to be assigned to it |
| let arr = [1,2,3]; | ||
| let arr = [1, 2, 3]; | ||
| console.log(arr[3]); | ||
| // the index in console.log does not exist in an array |
There was a problem hiding this comment.
Yes, the array has only 3 items so arr[3] is referencing an item that doesn't exist
| n--; | ||
| } | ||
|
|
||
| console.log(arr); |
There was a problem hiding this comment.
This logs out the array fine, looks good.
It's a minor point but the instruction is asking to log it out as a comma-separated string. Have a look at the array.join method.
|
|
||
| function evenNumbersSum(n) { | ||
| // TODO | ||
| let number = 0; |
| // TODO - Write for loop code here | ||
|
|
||
| for (let i = 0; i < WRITERS.length; i++) { | ||
| console.log(WRITERS[i] + " is " + AGES[i] + " years old"); |
|
|
||
| function getTemperatureReport(cities) { | ||
| // TODO | ||
| return cities.map( |
There was a problem hiding this comment.
You'll use map a lot in the future, so great that you've got it so quickly
|
perfect code,nice |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.