DEV Community

Discussion on: Day 3: 100 days of Code , Javascript Fundamentals, With Some Important Functions

Collapse
 
marzelin profile image
Marc Ziel

person[name] will not work

it won't work as expected here. If you do let name = "name" it'll work. In other words, you can use variables with bracket notation.

we cannot add or remove properties in case of "const" object

You can add, remove or change properties of the object. You can't reassign const:

const o = {};
o.prop = 1 // okay
o = {} // error
Enter fullscreen mode Exit fullscreen mode

There's a shortcut for creating methods:

studentInfo: function (){
Enter fullscreen mode Exit fullscreen mode

can be rewritten as:

studentInfo() {
Enter fullscreen mode Exit fullscreen mode

let myArray = new Array();

why would you ever want to create an array like this?

Collapse
 
gauravshekhawat profile image
Gaurav-Shekhawat

Thanks for your corrections, they mean a lot. These topics are new to me, so I was just skimming through them and believed that I will study them in detail whenever they come handy in my side projects. Thanks again!!