Javascript selftest

Which of the below are correct statements on JavaScript?
Please select none ore more correct alternatives.

Answer

Please see the resources below.

Reading

JavaScript
Where can you place your JavaScript in your web page?
Please select exactly one correct alternative.

Answer

Scripts can be placed in the <body>, or in the <head> section of an HTML page, or in both.
Which are correct examples for comments in JavaScript?
Please select none ore more correct alternatives.

Answer

Comments can be placed in between <!-- and --> or after // in JavaScript.
What are advantages of putting your JavaScript code into an external .js file?
Please select none ore more correct alternatives.

Answer

Placing JavaScripts in external files has some advantages:
  • It separates HTML and code.
  • It makes HTML and JavaScript easier to read and maintain.
  • Cached JavaScript files can speed up page loads.
What will this code result into?
You have following external JavaScript file and you include this file into your web page.
<script>
alert("Hello world!");
</script>
What will this result into?
Please select exactly one correct alternative.

Answer

Loading your web page in a browser will result in an error message because external scripts cannot contain <script> tags.
What is the difference between setTimeout and setInterval?
Please select exactly one correct alternative.

Answer

Both functions execute a given function in a given time. But setTimeout only executes this function once, while setInterval schedules a repeating execution.
Why is it not recommended to have many setInterval/setTimeout at the same time?
Please select exactly one correct alternative.

Answer

They cost a lot of CPU time. This could make your browser slow. Ofcourse, this depends on the processing power of your machine. In general, mobile devices are slower than e.g. desktop devices. It is preferred that a single setInterval / setTimeout call manages multiple animations.
What is Modernizr and what is it's purpose?
Please select exactly one correct alternative.

Answer

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user's browser.
Taking advantage of cool new web technologies is great fun, until you have to support browsers that lag behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not.
Which of the below are correct statements on JavaScript?
Please select none ore more correct alternatives.

Answer

You can use the sites below to learn about this topic.

Reading

JavaScript
Which of the following statements are correct on JavaScript output functions?
Please select none ore more correct alternatives.

Answer

Please see the correct answer above.
When using the
console.log
function in IE, please make sure that the console has been opened first. If not, IS will give an error message.
How can you minimize the global namespace pollution in JavaScript?
Please select exactly one correct alternative.

Answer

Please see the correct answer above.
Which method should you use when you want to delete an entry in a JavaScript array?
Please select exactly one correct alternative.

Answer

Please see the correct answer above.

No comments:

Post a Comment