User:Daniel.joppi

= Understanding the difference between Object.create and new SomeFunction =

Consider the following example: Notice that the same behavior is observed in both cases. It seems to me that the primary differences between these two scenarios are:
 * The object used in Object.create actually forms the prototype of the new object, where as in the new Function form the declared properties/functions do not form the prototype.
 * You cannot create closures with the Object.create syntax as you would with the functional syntax. This is logical given the lexical (vs block) type scope of JavaScript.
 * {| ! colspan="3" | ! colspan="6" |Compilers/polyfills ! colspan="16" |Desktop browsers ! colspan="4" |Servers/runtimes ! colspan="2" |Mobile |- !Feature name !Current browser58% ! ! Traceur 59% ! Babel + [1]71% ! Closure 30% ! JSX [2]18% ! Type- Script + 52% ! es6- shim 17% ! IE 10 10% ! IE 11 20% ! Edge 12 [3]67% ! Edge 13 [3]80% ! FF 38 ESR 66% ! FF 40 68% ! FF 41 70% ! FF 42 71% ! CH 45, OP 32 [4]58% ! CH 46, OP 33 [4]58% ! CH 47, OP 34 [4]63% ! SF 6.1, SF 7 12% ! SF 7.1, SF 8 21% ! SF 9 54% ! WK 66% ! KQ 4.14 [5]13% ! PJS 11% ! Node 0.12 [6]17% ! Node 4.0 [6]53% ! Echo JS 58% ! iOS7 12% ! iOS8 21% | colspan="73" |Optimisation |- |§proper tail calls (tail call optimisation)► |0/2 | |0/2 |1/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |- | colspan="73" |Syntax |- |§default function parameters► |0/7 | |4/7 |6/7 |4/7 |0/7 |4/7 |0/7 |0/7 |0/7 |0/7 |0/7 |3/7 |3/7 |3/7 |3/7 |0/7 |0/7 |0/7 |0/7 |0/7 |0/7 |7/7 |0/7 |0/7 |0/7 |0/7 |4/7 |0/7 |0/7 |- |§rest parameters► |0/5 | |4/5 |4/5 |2/5 |3/5 |3/5 |0/5 |0/5 |0/5 |5/5 |5/5 |4/5 |4/5 |4/5 |4/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |2/5 |0/5 |0/5 |- |§spread (...) operator► |0/15 | |15/15 |13/15 |3/15 |2/15 |4/15 |0/15 |0/15 |0/15 |12/15 |12/15 |15/15 |15/15 |15/15 |15/15 |0/15 |0/15 |15/15 |0/15 |5/15 |9/15 |9/15 |0/15 |0/15 |0/15 |0/15 |13/15 |0/15 |5/15 |- |§object literal extensions► |6/6 | |6/6 |6/6 |4/6 |5/6 |6/6 |0/6 |0/6 |0/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |0/6 |1/6 |5/6 |6/6 |0/6 |0/6 |0/6 |6/6 |4/6 |0/6 |1/6 |- |§for..of loops► |7/9 | |9/9 |9/9 |6/9 |2/9 |3/9 |0/9 |0/9 |0/9 |6/9 |6/9 |7/9 |7/9 |7/9 |7/9 |7/9 |7/9 |7/9 |0/9 |2/9 |8/9 |8/9 |0/9 |0/9 |7/9 |7/9 |6/9 |0/9 |2/9 |- |§octal and binary literals► |4/4 | |2/4 |4/4 |2/4 |0/4 |4/4 |2/4 |0/4 |0/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |0/4 |0/4 |4/4 |4/4 |0/4 |0/4 |0/4 |4/4 |4/4 |0/4 |0/4 |- |§template strings► |5/5 | |4/5 |4/5 |3/5 |4/5 |3/5 |0/5 |0/5 |0/5 |}
 * {| ! colspan="3" | ! colspan="6" |Compilers/polyfills ! colspan="16" |Desktop browsers ! colspan="4" |Servers/runtimes ! colspan="2" |Mobile |- !Feature name !Current browser58% ! ! Traceur 59% ! Babel + [1]71% ! Closure 30% ! JSX [2]18% ! Type- Script + 52% ! es6- shim 17% ! IE 10 10% ! IE 11 20% ! Edge 12 [3]67% ! Edge 13 [3]80% ! FF 38 ESR 66% ! FF 40 68% ! FF 41 70% ! FF 42 71% ! CH 45, OP 32 [4]58% ! CH 46, OP 33 [4]58% ! CH 47, OP 34 [4]63% ! SF 6.1, SF 7 12% ! SF 7.1, SF 8 21% ! SF 9 54% ! WK 66% ! KQ 4.14 [5]13% ! PJS 11% ! Node 0.12 [6]17% ! Node 4.0 [6]53% ! Echo JS 58% ! iOS7 12% ! iOS8 21% | colspan="73" |Optimisation |- |§proper tail calls (tail call optimisation)► |0/2 | |0/2 |1/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |0/2 |- | colspan="73" |Syntax |- |§default function parameters► |0/7 | |4/7 |6/7 |4/7 |0/7 |4/7 |0/7 |0/7 |0/7 |0/7 |0/7 |3/7 |3/7 |3/7 |3/7 |0/7 |0/7 |0/7 |0/7 |0/7 |0/7 |7/7 |0/7 |0/7 |0/7 |0/7 |4/7 |0/7 |0/7 |- |§rest parameters► |0/5 | |4/5 |4/5 |2/5 |3/5 |3/5 |0/5 |0/5 |0/5 |5/5 |5/5 |4/5 |4/5 |4/5 |4/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |0/5 |2/5 |0/5 |0/5 |- |§spread (...) operator► |0/15 | |15/15 |13/15 |3/15 |2/15 |4/15 |0/15 |0/15 |0/15 |12/15 |12/15 |15/15 |15/15 |15/15 |15/15 |0/15 |0/15 |15/15 |0/15 |5/15 |9/15 |9/15 |0/15 |0/15 |0/15 |0/15 |13/15 |0/15 |5/15 |- |§object literal extensions► |6/6 | |6/6 |6/6 |4/6 |5/6 |6/6 |0/6 |0/6 |0/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |6/6 |0/6 |1/6 |5/6 |6/6 |0/6 |0/6 |0/6 |6/6 |4/6 |0/6 |1/6 |- |§for..of loops► |7/9 | |9/9 |9/9 |6/9 |2/9 |3/9 |0/9 |0/9 |0/9 |6/9 |6/9 |7/9 |7/9 |7/9 |7/9 |7/9 |7/9 |7/9 |0/9 |2/9 |8/9 |8/9 |0/9 |0/9 |7/9 |7/9 |6/9 |0/9 |2/9 |- |§octal and binary literals► |4/4 | |2/4 |4/4 |2/4 |0/4 |4/4 |2/4 |0/4 |0/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |4/4 |0/4 |0/4 |4/4 |4/4 |0/4 |0/4 |0/4 |4/4 |4/4 |0/4 |0/4 |- |§template strings► |5/5 | |4/5 |4/5 |3/5 |4/5 |3/5 |0/5 |0/5 |0/5 |}