That object over there looks interesting
Tags: webbed, javascript, html, css
Published: 2021-01-18 02:13:47

# Controller Gang says "Hello" and Welcome

Hello, my name is Marcelo Varela and I am here to guide you on your journey to becoming a coding Master. In my last blog we talked about functions and methods, and today will be talking about ... 

#Objects!!

Ok, so what are objects? Objects are: a phone, a desk, a shoe. These are all objects and they each have properties and things they can do. Take the phone for Example: 

```js
/*
 ______________
 /              \ 
 |  Im A phone  | It has properties of:         Along with things it can do:
 |              | * colors                    * ring
 |              | * size                      * take a picture
 |              | * model                     * play music
 |              |
 |              |
 \ ____________ /
 */
```
Phones are great examples of objects because of these traits they have. But how do we show objects and all the stuff that goes with them? So how do __`Objects`__ work in JavaScript you may ask? Well let me show you.

First off we have two different types of objects: __`Object Literals`__ and __`Math Objects`__. 

#Object Literals

Objects in general are made up of variables that have attributes for example.

```js
let controllers = {
  consoleLinkedTo: 'XboxOneX',
  controllerColor: 'Ocean Blue',
  controllerTypes: 'elite', 'regular',
}
```

Then log to the console using the command:

```js
console.log(controllers);
```

if you wish to log certain attributes of an object, you need to use: .(attribute) command shown here:

```js
console.log(controller.consoleLinkedTo)
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6w1tijxxs5ti9z29ff64.jpeg)

The above piece of code is an example of a __`literal object`__ and their calling to the console. 

We can also add __`methods`__ or internal functions to the attributes inside the objects shown here:

```js
let controllers = {
  consoleLinkedTo: 'XboxOneX',
  controllerColors: 'Ocean Blue','armyGreen','White', 'Black'
  controllerTypes: 'elite', 'regular',
  rightTriggerTap: function (){
    console.log('controller user has tapped right trigger button and fired their weapon');
  },
  leftTriggerTap: function (){
    console.log(`controller user has tapped left trigger button and used their weapons scope`);
  },
}
```

#Math Objects

__`Math objects`__ are internally defined commands that can be used to implement mathematical properties into code. Some types of Math objects include:

```js
const areaOfController = 6.7in;

console.log(Math.round(radius);
``` 

Other Math commands include the implementations of __`.PI`__ and the numerical value __`.E`__ using:

```js
console.log(Math.PI);
console.log(Math.E);
```

Another fun tool ia the __`.random`__ tag which will grab a random whole number from whatever your boundary number is shown here:

```js
console.log(Math.random * 500))
```

#Too many enemies, need to regroup!!

Let me review what we went over in today's blog:
- first we learned what an object is,
- second we learned the two types of objects(__`literal objects`__ and __`Math Objects`__
- We also learned how to implement internal functions and methods into our code.
- Finally after writing the code we leaned to call them using __`console.log`__

#Thanks for Reading, controller gang thanks you!

I hope you learned something from this blog and I hope you have a great rest of your day or night. If you ever need help with anything else, don't shy away from shooting me a message down in the comments below. 



#References

Udemy-

 https://www.udemy.com

VSCode- 

https://code.visualstudio.com

IronHack Info Doc.- 

https://docs.google.com/document/d/1AOAFfkGFjcpUicEB-5pXbGsl53Nib8YoZDCA--A1z8o/edit?

Dev.to 
https://dev.to