Heroman: unless you’ve.

Held: Array_prototype_slice leaves less room for ambiguity or overlooked variable names.

Husman: Then just do Array.prototype.slice.call.

Delavega: So there’s *really* no performance difference?

Sabataso: I dunno, check the implementations of v8 and spidermonkey and hack microsoft

Hirsbrunner: No noteworthy difference

Libutti: Is there a way in javascript to distinguish between a function that was created with function abcd{} and one that was created with var abcd=function{} ?

Beatie: As far as I know, they’re just two different ways to do the same thing.

Libutti: What if you have a script blah.js and another script meh.js

Libutti: And they are both script files that you can import.

Libutti: But, blah.js uses meh.js and you want to use blah.js in many html files

Libutti: Does every html file that imports blah.js have to import meh.js too?

Libutti: Can blah.js import meh.js?

Dlugos: I think you have to import both in every HTML file.

Gentleman: Heroman: it’s slightly better to cache it.

Gentleman: Heroman: and it makes your script robust against delete Array.prototype.slice

Mate: Libutti: A function declaration function declared {} & a function expression e.g. var bar = function expressed {}: the former is !hoisted, the latter can be immediately invoked see !iife and can be anonymous eg can omit the name “expressed”. “function” as the first word of a statement at global scope or directly inside a function starts a function declaration; otherwise, it starts a function expression.

Hereth: Okay, thanks Gentleman. :3

Oszust: Should I also do that for Object.keys, Math.floor, etc.?

Gentleman: Libutti: and you’ll want to look into modules, and browserify. not just script tags.

Kalinoski: Gentleman is a veteran of harsh JS environments

Kalinoski: Where they delete Array#slice in the first line


Fiorito: Library authors deal with things that other people don’t

Gentleman: It’s totally legit to not care about a broken environment.

Gentleman: But, i think that if your module works, it should work in every environment.

Gentleman: Or rather, it should work in any environment, even one that’s intentionally broken after your code runs

Gentleman: Certainly any breakage before your code runs, you can’t protect against.

Curdy: So, in case Array.prototype.forEach is deleted after the fact, you should use your cached copy every time, even on actually Array-s?

Gentleman: And in forEach’s case, i’d use the foreach module, so it works in ES3.

Stouer: What if Function.prototype.call is broken? D:

Kalinoski: You can cache that too

Cork: Umm.but how do you even *use* it? XD

Hillman: Function.prototype.call.call? 😛

Gentleman: Heroman: using the function-bind module, you can do var slice = bind.callFunction.call, Array.prototype.slice;

Gentleman: And then slicearr, start, end

Blackson: Function-bind module? This I gotta see.

Gentleman: Or, var call = bind.callFunction.call, Function.call so you can do callfunc, arg1, arg2 etc.

Gentleman: Function-bind is an ES3-compatible Function#bind shim.

Kalinoski: If you delete Function#call it breaks node immediately

Kalinoski: I don’t know what happens in the browser

Gentleman: Node is just very brittle in that sense.

Gentleman: I haven’t had time to go PR my way through all of node to fix that. yet.

Kalinoski: Changing a lot of built-in prototypes at all will break node

Cava: But if you break Function.prototype.call in your own environment, you’re FUBAR, right?

Gentleman: Heroman: unless you’ve cached it previously in the way i described.