Posts

Showing posts with the label JavaScript - Tutorial points

JavaScript - closure Tutorial Points (4)

Image
Create a separate function using JavaScript closure which accepts the tax percentage and returns a function that accepts the amount and returns the amount after adding tax percentage. Try adding tax percentage to ‘this’ object and check if it works. <! DOCTYPE   html >   < html   lang = "en" >      < head >          < meta   charset = "UTF-8" >          < meta   http-equiv = "XX-UA-Compatible"   content = "IE=edge" >          < meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >          < title > AF LAB 01 - Ex 04 </ title >      </ head > < body >   < script >     /*Create a separate function...

JavaScript - JSON Tutorial Points (3)

Image
Use curly brackets to create JSON like JavaScript object and add properties and functions to the object. JSON is a type of  data-saving format. it saves data using key and value pairs. <! DOCTYPE   html >   < html   lang = "en" >      < head >          < meta   charset = "UTF-8" >          < meta   http-equiv = "XX-UA-Compatible"   content = "IE=edge" >          < meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >          < title > AF LAB 01 - Ex 02 </ title >          <!-- JSON is a type of data saving format.it sa...

JavaScript - this key Word Tutorial Points (2)

Image
  Understand the ‘this’ keyword in JavaScript.  a. Declare a global variable named vehicle name in the window object.  b. Declare a method named printVehicleName to print out the vehicle name.  c. Declare an object named Vehicle(using object literal notation) which have a variable called vehicle name and declare a function named getVehicleName and assign it with the printVehicleName.  d. Execute the printVehicleName function and the getVehicleName functions to see the results.  e. Correct the getVehicleName to print out the global variable vehicle name using the this keyword <! DOCTYPE   html >   < html   lang = "en" >      < head >          < meta   charset = "UTF-8" >          < meta   http-equiv = "XX-UA-Compatible"   content = "IE=edge" >          < meta...

JavaScript - this key Word Tutorial Points (1)

Image
Objective: Teach a set of basic concepts in the JavaScript programming language. Create a function as a variable (function expression) that prints ‘Hello World’ to console and another function that accepts a variable. The argument passed to the second the function should be executed as a function inside the body. Call the second function passing the first function as the argument. <! DOCTYPE   html >   < html   lang = "en" >      < head >         < meta   charset = "UTF-8" >       < meta   http-equiv = "XX-UA-Compatible"   content = "IE=edge" >       < meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >            < title > Tutorial point - Ex 01 </ title >      </ head > < body >...