• +91 9723535972
  • info@interviewmaterial.com

Java Script Interview Questions and Answers

Question - How to associate functions with objects using JavaScript?

Answer - Let's now create a custom "toString()" method for our movie object. We can embed the function directly in the object like this. This produces title: Narni director: Andrew Adamson Or we can use a previously defined function and assign it to a variable. Note that the name of the function is not followed by parenthesis, otherwise it would just execute the function and stuff the returned value into the variable. This produces title: Aliens director: Cameron  

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners