+ 1

Objects in JS

Who knows how to make an object in Javascript

21st Jun 2024, 12:38 PM
Kelechi Egwuatu
Kelechi Egwuatu - avatar
4 Antworten
21st Jun 2024, 5:27 PM
SoloProg
SoloProg - avatar
+ 2
let obj = {"a":1} and I am sure you could have found it out if you did your own research.
21st Jun 2024, 2:16 PM
Lisa
Lisa - avatar
+ 2
Hey Kelechi Egwuatu I’m not sure where this was covered in the courses offered here. But Objects are created using the {} syntax, with each key-value pair separated by a comma. Like in Lisa's example: let obj = {"a": 1}; Here's what's happening: let is a keyword that declares a variable. In this case, we're creating a variable called obj. obj is the name of the variable. = is the assignment operator, which assigns a value to the variable. {"a": 1} is the value being assigned to the variable. I’d like to encourage you to keep asking questions. But also take Lisa's advice, researching is a good skill to have. Happy coding!
21st Jun 2024, 5:33 PM
Chris Coder
Chris Coder - avatar
0
function nada(name,){ name = name}
22nd Jun 2024, 1:31 AM
Arthur Fellipe
Arthur Fellipe - avatar