Skip to content
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

enmanuel-delanuez submission #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions enmanuel-delanuez/exercises/answers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ function triangle() {
// Question 2: FizzBuzz
function fizzBuzz() {
for (let i = 1; i <= 100; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You're using non-strict equality here (== instead of ===). Since you're dealing with numbers only, it shouldn't be an issue but it is still good practice to always use strict equality comparisons

if (i % 3 == 0 && i % 5 == 0) {
if (i % 3 === 0 && i % 5 === 0) {
console.log('FizzBuzz');
} else if (i % 3 == 0) {
} else if (i % 3 === 0) {
console.log('Fizz');
} else if (i % 5 == 0 && i % 3 != 0) {
} else if (i % 5 === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Great changes to this question 👍

console.log('Buzz');
} else {
console.log(i);
Expand Down
8 changes: 5 additions & 3 deletions enmanuel-delanuez/short-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

1. **What does the code below log? Why?**
Copy link
Contributor

Choose a reason for hiding this comment

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

You got rid of the brackets from the original version but I want them in there. This is what the question originally looked like:

{
   let singer = 'Omar Apollo';
 }

 console.log(`My favorite singer is ${singer});

Those brackets are important for this question.

```javascript
let singer = 'Omar Apollo';
{
let singer = 'Omar Apollo';
}
console.log(`My favorite singer is ${singer}`);
```
This logs `'My favorite singer is Omar Apollo'` because the use of `${}` interpolates the value of a binding into the string.
This logs `ReferenceError: singer is not defined` because `console.log()` is looking for the variable `singer` in its global scope and cannot see it because it has a block scope. This is also supported by the keyword `let`, whereas the keyword `var` has a global or function scope.
Copy link
Contributor

Choose a reason for hiding this comment

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

That's it! Perfect answer!


2. **What happens when we run the following code? Why?**
```javascript
Expand All @@ -16,7 +18,7 @@
favorite = 'Maya';
console.log(`Actually, ${favorite} is my favorite.`);
```
This logs `'Our favorite Marcy Lab family member is Juan Pablo'` because the binding `favorite` was declared with the keyword `const`, meaning it is a constant that can't be reassigned.
This logs `'Our favorite Marcy Lab family member is Juan Pablo'`. After, it logs a `TypeError` because the binding `favorite` was declared with the keyword `const` and we tried to reassign it before the second log which is not allowed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect! Great revision.


3. **What does the following code log? Why?**
```javascript
Expand Down