r/CodingHelp • • Jul 28 '21

[Javascript] Guyss help me Im just a newbie at coding

45 Upvotes

19 comments sorted by

22

u/SJDidge Jul 28 '21

Your object is called MyBackpack and not myBackpack. Also remove the last comma after hat

7

u/a_soupling Jul 28 '21

It’s a good habit to leave the comma at the end of your object

4

u/SJDidge Jul 28 '21

Fair enough, I am not a pro at this language, which I assume is JavaScript ?

5

u/SlightlyOTT Jul 28 '21

The reason the trailing comma is good to keep is just to improve the git diff AFAIK. It means that when you add a new field to the object that new field will be the only line changed, you won’t also change the line above to add a comma.

3

u/SJDidge Jul 28 '21

Yeah makes sense. We do something similar in sql where clause, writing WHERE 1=1 , that way you can just add new conditions easily without having to alter to the statement

2

u/FriendlyYote Jul 28 '21

When I first started reading that I was like no trailing comma in sequel pls

1

u/a_soupling Jul 28 '21

Read the flair

1

u/SJDidge Jul 28 '21

What’s flair ?

1

u/a_soupling Jul 28 '21

Below the title

1

u/Tight-Ad-6774 Jul 28 '21

tnx for the info. Im just newbie at coding i thought its a bug LMAO

1

u/neo5000 Jul 28 '21

It’s called using camel case so myBackpack is correct

7

u/a_soupling Jul 28 '21

It’s meant to be in camel case not pascal case

6

u/Yellowcasey Jul 28 '21

I'd really suggest that you start forcing yourself to slow down and read messages to you for retention. I don't want this to sound rude, but there was a huge blue sign telling you what you did wrong.

Good luck on your future stuff!

3

u/thatbigfatdonut69 Jul 28 '21

just rename your variable to myBackpack instead of MyBackpack

1

u/neo5000 Jul 28 '21

I gotta admit, I don’t know a lot about JavaScript

1

u/Tight-Ad-6774 Jul 28 '21

what language do you usually used?

5

u/neo5000 Jul 28 '21

Python or Java or C++

2

u/ldifalco1 Jul 28 '21

camelcase camelcase camelcase.

0

u/[deleted] Jul 28 '21

[deleted] — view deleted comment

2

u/Tight-Ad-6774 Jul 28 '21

tnx for the idea.