How work function. Js

Please, explain how this function works in detail. Thank you.

Why don’t you start with telling us how you think it works? Is there any part in specific that confuses you?

edit: I don’t think this function will work.

Create new prop in object serafim, and push some phrase in array of this object.It is works

I see you changed the screen shot. Now I can see what you are trying to do. You pretty much explained the code yourself though, you are adding a property to serafim.some. So the first time you call the function, serafim.some does not exist so you create an empty array, then the second time you call the function serafim.some exists, so you just use that. I believe the serafim.some at the end would be ["serafim", "seraf"]

I would recommend reading You Don’t Know JS for a better explanation of whats happening here.

2 Likes

Thanks, maybe you recommend some exercise of js that simply than fcc ? Cause it’s kind of difficult to me :frowning: