Copy edits (#35536)
* Copy edits to Basic JavaScript section * Copy edits to ES6 section * Update index.md
This commit is contained in:
committed by
The Coding Aviator
parent
768b618e68
commit
914a7c522d
@@ -11,8 +11,8 @@ We have an array of objects representing different people in our contacts lists.
|
||||
A <code>lookUpProfile</code> function that takes <code>name</code> and a property (<code>prop</code>) as arguments has been pre-written for you.
|
||||
The function should check if <code>name</code> is an actual contact's <code>firstName</code> and the given property (<code>prop</code>) is a property of that contact.
|
||||
If both are true, then return the "value" of that property.
|
||||
If <code>name</code> does not correspond to any contacts then return <code>"No such contact"</code>
|
||||
If <code>prop</code> does not correspond to any valid properties of a contact found to match <code>name</code> then return <code>"No such property"</code>
|
||||
If <code>name</code> does not correspond to any contacts then return <code>"No such contact"</code>.
|
||||
If <code>prop</code> does not correspond to any valid properties of a contact found to match <code>name</code> then return <code>"No such property"</code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@@ -9,7 +9,7 @@ videoUrl: 'https://scrimba.com/c/cyWJBT4'
|
||||
<section id='description'>
|
||||
In the previous challenge, you used a single <code>conditional operator</code>. You can also chain them together to check for multiple conditions.
|
||||
The following function uses if, else if, and else statements to check multiple conditions:
|
||||
<blockquote>function findGreaterOrEqual(a, b) {<br> if(a === b) {<br> return "a and b are equal";<br> }<br> else if(a > b) {<br> return "a is greater";<br> }<br> else {<br> return "b is greater";<br> }<br>}</blockquote>
|
||||
<blockquote>function findGreaterOrEqual(a, b) {<br> if (a === b) {<br> return "a and b are equal";<br> }<br> else if (a > b) {<br> return "a is greater";<br> }<br> else {<br> return "b is greater";<br> }<br>}</blockquote>
|
||||
The above function can be re-written using multiple <code>conditional operators</code>:
|
||||
<blockquote>function findGreaterOrEqual(a, b) {<br> return (a === b) ? "a and b are equal" : (a > b) ? "a is greater" : "b is greater";<br>}</blockquote>
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user