Basic JavaScript Interview Questions and Answers

JavaScript Questions and Answers:

1 :: What are decodeURI() and encodeURI() functions in JavaScript?

Many characters cannot be sent in a URL, but must be converted to their hex encoding. These functions are used to convert an entire URI (a superset of URL) to and from a format that can be sent via a URI.

<script type="text/javascript">
var uri = "http://www.google.com/search?q=Online Web Tutorials at GlobalGuideLine"
document.write("Original uri: "+uri);
document.write("<br />encoded: "+encodeURI(uri));
</script>
0/5 Rating (0 vote)
Is This Answer Correct?    1 Yes 0 No
Place Your Answer

2 :: What's Prototypes for JavaScript?

Objects have "prototypes" from which they may inherit fields and functions.

<script type="text/javascript">
function movieToString() {
return("title: "+this.title+" director: "+this.director);
}
function movie(title, director) {
this.title = title;
this.director = director || "unknown"; //if null assign to "unknown"
this.toString = movieToString; //assign function to this method pointer
}
movie.prototype.isComedy = false; //add a field to the movie's prototype
var officeSpace = new movie("OfficeSpace");
var narnia = new movie("Narni","Andrew Adamson");
document.write(narnia.toString());
document.write("
Narnia a comedy? "+narnia.isComedy);
officeSpace.isComedy = true; //override the default just for this object
document.write("
Office Space a comedy? "+officeSpace.isComedy);
</script>
5/5 Rating (1 vote)
Is This Answer Correct?    1 Yes 0 No
Place Your Answer

3 :: How to create a function using function constructor?

The following example illustrates this
It creates a function called square with argument x and returns x multiplied by itself.
var square = new Function ("x","return x*x");
4/5 Rating (2 votes)
Is This Answer Correct?    2 Yes 0 No
Place Your Answer

4 :: What does break and continue statements do in JavaScript?

Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop in JavaScript.
4/5 Rating (1 vote)
Is This Answer Correct?    1 Yes 0 No
Place Your Answer

5 :: What is eval() in JavaScript?

The eval() method is incredibly powerful allowing us to execute snippets of code during execution in JavaScript.

<script type="text/javascript">
var USA_Texas_Austin = "521,289";
document.write("Population is "+eval("USA_"+"Texas_"+"Austin"));
</script>

This produces
Population is 521,289
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

Rate This Category:
4/5 Rating (1 vote)
Place Your Question



Top: Basic JavaScript Interview Questions and Answers
Basic JavaScript Interview Questions and Answers

Top Frequently Asked JavaScript Question
Frequently Asked JavaScript Job Interview Question


Top Frequently opened World Wide Web Job Interview categories
Most popular World Wide Web Job Interview categories

Comments About Basic JavaScript Interview Questions and Answers

Share your valuable opinions, ideas and suggestions about Basic JavaScript Interview Questions and Answers
While placing your comment your email address is required but won't be published any where else; Personal information will be kept confidential; we do not sell or release our respective visitors private information.
  1. Webmaster 20th of May 2012

    Webmaster Said

    Tell us what you feel about Basic JavaScript Interview Questions and Answers
    All comments will be published after review. No login or registration is required to post a comment on Basic JavaScript Interview Questions and Answers We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
    So start sharing your thoughts regarding Basic JavaScript Interview Questions and Answers
    Thank you.

Leave a Comment

Leave a Comment
  1.  Enter This Verification Code  Regenerate Verification Code  



Your reply will be added to the comment above (Below any other replies to this comment) -

Top Comments About: Basic JavaScript Interview Questions and Answers
Comments on Basic JavaScript Interview Questions and Answers

 
Top of Link batk to Basic JavaScript Interview Questions and Answers
Link batk to Basic JavaScript Interview Questions and Answers