Q. two function declarations and its meaning

var functionOne = function() { // Some code };

function functionTwo() { // Some code }

functionOne is a function expression and so only defined when that line is reached

functionTwo is a function declaration and is defined as soon as its surrounding function or script is executed

For example,

// TypeError: undefined is not a function

functionOne();

var functionOne = function() {

console.log("Hello!");

};

Further Reference : Variable and Function Hoisting in JavaScript

Q. String to Number

Unary Plus (+)

The unary plus operator precedes its operand and evaluates to its operand but attempts to convert it into a number.

Examples
+3     // 3
+'3'   // 3
+true  // 1
+false // 0
+null  // 0
+function(val){  return val } // NaN

results matching ""

    No results matching ""