JSFiddle - React, Tailwind, and code Playground

by Bhavin Surela

HTML

<!--for question 2 -->
In my life, I used the following web search engines:<br/>
   <a href="//www.yahoo.com" data-name="yahoo">Yahoo!</a><br/>
   <a href="//www.altavista.com" data-name="altavista">AltaVista</a><br/>
   <a href="//www.google.com" data-name="google">Google</a><br/>

JavaScript

/*
1) Give an exmaple of javascript inheritance. Create a base class "Car" and create two sub classes "Honda" and "Chevy". Create a function called "hello" which when called, displays the name of the car on the screen. create other functions specific to Honda and Chevy,  call all of those functions for both subclasses demonstrating inheritance.

-- answer they should be using prototype and have understanding of how to do inheritance in javascript

*/

/*
2) example of closure, fix errors in this function and
*/
function registerHandlers() {
  var as = document.getElementsByTagName('a');
  for (i = as.length; i-- >= 0;) {
    as[i].onclick = function() {
      // write code to display the name on the screen.
    }
  }
}

/*
  3)
  What will be the output of this code
*/


function a(){
  setTimeout(function(){
    console.log('text - A');
  },0);
};

function b(){
  console.log('text - B');
}

a()
b()

/*
 Answer

  // 'text - B'
  // 'text - A'
*/


/*
4) Angular difference between provider and services, when to use which
*/

/*
5) Explain Dependency injection in frameworks like angular and how they work 
*/

/*
6) jQuery.hide/show vs display:none, which is better.
*/

/*
7) Why scripts at the end of the page
*/
/*
8) When to use == and ===

/*
9) Write an html and javascript that inserts the value from the textbox to the top of the array and displays it on screen
*/