Question 01

Create a function as a variable (function expression) that prints ‘Hello World’ to console and another function which accepts a variable. The argument passed to the second function should be executed as a function inside the body. Call the second function passing the first function as the argument. Check the output.


Question 02

 Declare a global variable named "vehicleName in the window object.

 Declare a method named printVehicleName to print out the vehicle name .

 Declare an object named Vehicle(using object literal notation) which have a variable called vehicleName and declare a function named getVehicleName and assign it with the printVehicleName  Execute the printVehicleName function and the getVehicleName functions to see the results.

Correct the getVehicleName to print out the global variable vehicleName using the this keyword.

Question 03

Create a separate function using JavaScript closure which accepts the tax percentage and returns a function which accepts the amount and returns the amount after adding tax percentage. Try adding tax percentage to

‘this’ object and check if it works.

Question 04

Write a function to call GitHub API (https://api.github.com/users) and get users and return the users to the caller



ANSWERS FOR THE ABOVE QUESTIONS ARE GIVEN BELOW













JavaScript is one of the 3 languages all web developers must learn:

   1. HTML to define the content of web pages
   2. CSS to specify the layout of web pages
   3. JavaScript to program the behavior of web pages

Web pages are not the only place where JavaScript is used. Many desktop and server programs use JavaScript. Node.js is the best known. Some databases, like MongoDB and CouchDB, also use JavaScript as their programming language.