New course! Every coder should learn Generative AI!
Try a free lesson+ 4
I think you can't directly include function like that in an object ,it needs to have a key
Like
start:function start()
or whatever name you want
+ 3
start: function () {
.......
}
https://www.w3schools.com/js/js_object_methods.asp
+ 2
Dilyorbek Valijonov yes, that's also valid as of ES6.
+ 2
Dilyorbek Valijonov Yes, typically you'd use methods with OOP class objects. It's usually best if you can help it to stick with one style or the other within a JS module IMO. It helps to reduce issues and errors. At least that's what I started doing for the most part, after a few facepalms. Lol