freeCodeCamp Challenge Guide: Declare JavaScript Objects as Variables

freeCodeCamp Challenge Guide: Declare JavaScript Objects as Variables
0.0 0

#1

This has a simple format. You declare your variable and have it equal to an object in the form { key: value}

var car = {
  "wheels":4,
  "engines":1,
  "seats":5
};
``
i am gonna go ahead and solve this in as simplest way as possible. the way i understood
here are few things u need to know to make it simple and easy

1. The way u create any variable like
var this_variable = "string";

u also create object very similar to this, watch below
var this_variable = {
now here u can have your list or items and assign values to them
};

noticed the difference?
after the equal sign there are curly brackets  and inside those brackets u use attributes and give values to them, it makes sense right?

now let's back to our actual question here
the question is this

"Give your motorBike object a wheels, engines and seats attribute and set them to numbers."
now read above explanation and try to solve this, however if is still not clear then let me make it for u

i am gonna divide the question into two parts and let's solve the first one
"Give your motorBike(which means u need to work on motorBike object only) object a wheels, engines, and seats attribute"
u might know how to create attributes but lemme show u how
u could think of a attribute as a thing, it could be, "toothpase" "cricketbat" "movieshow" "pasta" "44" 
and u yourself(no just kidding)
it is a property and every attribute must have a value and that's the attribute of that property

back to first part of the actual question
"Give your motorBike(which means u need to work on motorBike object only) object a wheels, engines, and seats attribute"
u know where u need to work like this

var motorBike(we have done this because question said "Give your motorBike") = {
"wheels": 
  "engines":
  "seats": 
now all three things above are property attributes
let's move to the second part now and solve the question
"wheels": 2(because the question said "set them to numbers"),
"engines": 3,
"seats": 4
now on your left are the value attributes, of course u give whatever value u want
  // Only change code below this line.

};

our final solution would look like this

var motorBike = {
"wheels": 2,
  "engines": 3,
  "seats": 4
  // Only change code below this line.

};

let me know if it helps u
i am @CodeMaster0

#2