Basic JavaScript Day 2: Homework

Day2 Homework completed.

1 Like

Thank you for lessons.
I was able to finish the homework without problem, but one thing is bothering me.
I thought that variable declared as const cannot be changed.
However, while I was doing “Modify Array Data With Indexes”, I figured I could modify values of an array declared as const.
Reading through [Var, Let, and Const – What’s the Difference? (freecodecamp.org)], I was confirmed that I could do that.
So, my understanding is that const cannot be overwritten, but can be modified (not by overwriting).
Am I understanding correctly?

2 Likes

Homework completed. Thanks!

1 Like

Great question! We also explored this In yesterday’s lesson.

You are correct. By modifying members of the array, we’re not reassigning the variable, which is constant. Arrays are mutable.

I don’t know what is wrong with my code here


Test case not passing even though I have used myArray.pop();

Hey!

So if you console.log(myArray.pop()); you’ll see that it returns that popped value.

What the exercise wants you to do is assign that popped value to the variable. You’re writing out the value manually.

Hope that makes sense!

1 Like

Yes, the Tests passed Thanks Ramón for your quick reply.

You’re welcome! It’s my pleasure

Homework finished.

3 Likes

I am stuck with this question, Help!

1 Like

Catching up fast over here, working on this after work, missed days 1, 2 and 3 but I should be up to date with the homework for Day III by tomorrow eve.

1 Like

Here’s day 2 homework.

Capture090722JSBC

Hello Everyone!
Hope everyone doing well today! I am still struggling with the Day 2 homework. I had a question when I practiced Access Array Data with Indexes. Can I get a character or number of the entry from an array? Can anyone figure out why the result of console.log(myNumber) was undefined in the pic? Thank you for your help!
1662590019058

1 Like

Getting caught up today after a day road trip with my girlfriend :slight_smile:

4 Likes

Caught up with my D2 homework, the shopping list gave me something to think about. Turned out I used nested arrays instead of sub-arrays… oops!

2 Likes

You’re trying to access myData2.length. But myData2 is not an array, it’s a number! Numbers don’t have length.

3 Likes


Day 2 Homework done!

2 Likes

Day 2 Homework Done!
I’m getting caught up! :smiling_face:

2 Likes

Thank you for your reply. It was really helpful. I am curious that if I want to extract one single number from an array which is a group of numbers, what should I do? Let’s say I want to get the "8 " from “23847” and show it on the output. Is there any way I can make it?

1 Like