I do understand Arrow functions are like built-in functions in that both
lack .prototype and any [[Construct]] internal method.

But why does the scope refer to the global in case of :

```
String.prototype.repeat = (n) => Array(+n+1).join(this);

"ES6 ".repeat(3);

// will result in "[object Window][object Window][object Window]"
```

Whereas:

```
String.repeat = (n) => Array(+n+1).join(this);

"ES6 ".repeat(3) // Works fine resulting in "ES6 ES6 ES6"

```

Sorry if I'm missing something trivial. I did go through spec.

[spec](http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax)

-- 
*'I am what I am because of who we all are'*
h3manth.com <http://www.h3manth.com>
*-- Hemanth HM *
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to