Skip to content

Instantly share code, notes, and snippets.

@junosuarez
Created June 6, 2015 16:58
Show Gist options
  • Save junosuarez/00fb15357b09da934fd1 to your computer and use it in GitHub Desktop.
Save junosuarez/00fb15357b09da934fd1 to your computer and use it in GitHub Desktop.
String.prototype.c = function (b) { console.log(this); return this.concat(b) }
String.c(b)
"a".c("b")
VM2531:2 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
"ab"
("a".c)("b")
VM2531:2 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
"ab"
d = "a".c
String.c(b)
d("b")
VM2531:2 Window {top: Window, location: Location, document: document, window: Window, external: Object…}
VM2531:2 Uncaught TypeError: this.concat is not a function
at String.c (<anonymous>:2:68)
at <anonymous>:2:1
at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)
function i(x) { return x }
undefined
i("a".c)("b")
VM2531:2 Window {top: Window, location: Location, document: document, window: Window, external: Object…}
VM2531:2 Uncaught TypeError: this.concat is not a function
at String.c (<anonymous>:2:68)
at <anonymous>:2:9
at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)
("a".concat.valueOf())("b")
VM507:2 Uncaught TypeError: String.prototype.concat called on null or undefined
at concat (native)
at <anonymous>:2:23
at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)
x = "a".concat.valueOf()
concat()
x("b")
VM211:2 Uncaught TypeError: String.prototype.concat called on null or undefined
at concat (native)
at <anonymous>:2:1
at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)(anonymous function) @ VM211:2InjectedScript._evaluateOn @ VM76:895InjectedScript._evaluateAndWrap @ VM76:828InjectedScript.evaluate @ VM76:694
x.call("a","b")
"ab"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment