SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Sunday, November 2, 2014

Javascript : You might also like - I

Javascript hoisting

  1. http://jamesallardice.com/explaining-function-and-variable-hoisting-in-javascript/
  2. http://blog.caplin.com/2012/01/18/javascript-is-hard-part-2-the-hidden-world-of-hoisting/
  3. http://code.tutsplus.com/tutorials/the-essentials-of-writing-high-quality-javascript--net-15145
  4. http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html

What's the difference b/w the two declaration methods below ?

var functionOne = function() {
    /* some code */
}
function functionTwo() {
    /* some code */
}
functionOne is defined in-place(until that line, functionOne is undefined),
whereas functionTwo is hoisted to the top of the scope and is available
as function throughtout the scope. 

Logical Q's

  1. true + true  returns 2
  2. Math.min() < Math.max(); will return false

Friday, October 31, 2014

Things you may not know about Javascript

Object Literal provide a very convenient notation for creating new object values. An object literal is a pair of curly braces surrounding zero or more name/value pairs.

var empty_obj={};
var stooage={"firstname":"Gen","lastname":"Linux"}

Objects can nest.

var flight={
      air:"BA",number:"335",departure:{Gate:"45"}
}

Undefined value is produced if an attempt is made to retrieve a non-existent member.

stooage.status     // undefined
flight["area]        // undefined

Attempting to retrieve values from undefined will throw a TypeError exception.

flight.equipment         // undefined
flight.equipment.model      // throw "TypeError"

This can be guarded against with the && operator:

flight.equipment && flight.equipment.model       // undefined


Reference

Objects are passed around by reference. They are never copied:

var x=stooge;
x.nickname = 'Curly';
var nick = stooge.nickname;
// nick is 'Curly' because x and stooge

// are references to the same object

Function Literal

Function objects are created with function literals:

// Create a variable called add and store a function
var add = function (a, b) {
return a + b;

};

Tuesday, October 28, 2014

Javascript Interview Questions you might expect

If you want to through the interview for a Front-end or UI developer then you should know the below questions.

  1. Tell about yourself.
  2. Projects you have worked
  3. How to debug javascript code.
  4. Chrome Developer tools.
  5. What is Closures ?
  6. Strategies in Javascript ?
  7. Difference b/w Object oriented Programming vs Prototype based Programming?
  8. What's the usage of closures ?
  9. What is closures ?
  10. What is event bubbling ?
  11. What is JavaScript Hoisting
  12. Jquery transverse parent() vs parents vs parentuntil ?
  13. In Json what’s the difference b/w dot notation and bracket notation
  14. CSS sprites
  15. Type of  data that you're expecting back from the server for Ajax calls.
  16. Which one is faster ID or Class.
  17. Position relative vs Position absolute.
  18. Difference  b/w == and ===
  19. Difference between null and undefined
  20. Difference between Display: none and Visibility: hidden ?
  21. Angular - How to pass values from one directive to other ?
  22. Promises in angular ?
  23. Bower search ?
  24. Grunt server ?
  25. How to create objects in javascripts ?
  26. Jquery remove ?
  27. How to select nth li ?
  28. javascript code debug  a function { abc} problem
  29. Position : fixed vs static vs absolute
  30. CSS3 colors configuration
  31. Diff b/w bind and on
  32. What is event bubbling and event propagation
  33. What is object chaining ?
  34. What is the scope of this ?
  35. What is jsonp ?
  36. Quirks mode and standard mode ?
  37. How to invoke javascript methods ?
  38. What is this ?
  39. How do u use ajax ?
  40. What is closure ?
  41. Difference b/w scopes vs rule scopes ?
  42. CSS3 transitions
  43. Background - gradient
  44. Javascript inheritance ?
  45. Closures in javascripts ?
  46. Javascript hoisting ?
  47. Promises in Javascript ?
  48. Memory leaks in Javascript ?
  49. How to create objects in javascripts ?
  50. Angular directives ?