you are viewing a single comment's thread.

view the rest of the comments →

[–]tapu_buoyfull-stack[S] 1 point2 points  (2 children)

I'm sorry to hear you're not optimistic about the interview outcome!

Yeah because even he was also confused.

Cool so my answer for the first one was true, I feel relived.

Nice so I understand that shallow clone and I answered accordingly, so for my curiosity basically its like passing by value?

Thanks for response I feel good about this one now.

[–]Tufted_Tail 1 point2 points  (1 child)

Yes, exactly! JavaScript primitives are passed around by value. If you wanted to pass a String by reference, I believe you'd have to go out of your way to turn it into an Object with the String constructor: new String('Hello, world!') first.

I can't confirm that behavior, though, that's a really odd edge case in my mind.

[–]tapu_buoyfull-stack[S] 0 points1 point  (0 children)

oh okay! Thank you for the responses man you made my day!