Strike Force Heroes 2
The explosive sequel to the hit game Strike Force Heroes!
3.95 / 5.00 7,536 ViewsObsolescence
Defeat the enormous mechanical beasts--and become one of them.
4.01 / 5.00 40,114 ViewsThat happens because of how JavaScript treats empty arrays (which is, a lot of the, treated as a string).
So that first piece of code:
(![]+[])
Creates the string "false".
This is because when you do this:
![]
You get a boolean false, because an array is not considered false, so therefore when used with the ! (not) operator returns false. Inversely if you were to do this:
!![]
You would get a boolean true, but that's not really important.
In order to convert the boolean to a string the boolean is incremented by an array; that is the same as incrementing by an empty string. The following two lines do the same thing:
![]+[]; // "false"
![]+""; // "false"
So now you have the string "false" and need to get the "f" out of it, which is at index position 0.
Before explaining that, take the following for example:
+5; // 5
-5; // -5
-+5; // -5
+-+5; // -5
-+-5; // 5
The positive/negative symbols do pretty much what you'd expect:
- Positive plus Positive equals Positive
- Positive plus Negative equals Negative
- Negative plus Negative equals Positive
Or, in other words:
- No negative sign, or equal number of negative signs, equals Positive
- Otherwise equals Negative
What happens when you use these with an empty array?
+[]; // 0
-[]; // -0
Yes, negative zero really is a thing.
So using that, you can easily get the "f" from a string of "false":
var falseStr = ![]+[]; // "false"
var fStr = falseStr[+[]]; // "f"
// One line:
(![]+[])[+[]];
Now knowing how to do goofy shit like that, you can break that code into smaller chunks:
// Generates "f":
(![]+[])[+[]];
// Generates "a":
(![]+[])[+!+[]];
// Generates "i":
([![]]+[][[]])[+!+[]+[+[]]];
// Generates "l":
(![]+[])[!+[]+!+[]];
And it stops becoming an incomprehensible mess.
Make sense now? :)
P.S.
I don't consider this a "fail" at all; just a neat trick produced by abusing the hell out of JavaScript.
At 7/23/12 02:32 PM, Diki wrote: Make sense now? :)
P.S.
I don't consider this a "fail" at all; just a neat trick produced by abusing the hell out of JavaScript.
bWF5IGJlIHBpY3R1cmUgdGFsayBpbnN0ZWFkIG9mIG1lLg==
Ignoring the stupid memes this video is a pretty interesting talk on some goofy things JavaScript does (as well as Ruby).
And this post explains why JavaScript does the things that are outlined in the video.
At 7/25/12 05:08 AM, citricsquid wrote: http://phpjs.hertzen.com/
good for some fun I gues, as the docs say it's not recommended for production env
At least not a muffin.
At 7/25/12 07:01 PM, doodle-bread14 wrote: What's up guys?
Posted 2 days ago. Embarrassing.
OT: Been making this site from like 9pm to now (almost 6am). Don't know how much longer can I last
At 7/27/12 11:48 PM, NinoGrounds wrote: Posted 2 days ago. Embarrassing.
OT: Been making this site from like 9pm to now (almost 6am). Don't know how much longer can I last
Having problems, huh? Me too.
At least not a muffin.
At 7/28/12 08:35 AM, doodle-bread14 wrote: Having problems, huh? Me too.
Not really, just a lot of content.
At 7/28/12 10:20 AM, NinoGrounds wrote: Not really, just a lot of content.
Gzzbshgmdfck... And how's the website going?
At least not a muffin.
Last night I spent over 6 hours refactoring my SimpleJS JavaScript framework.
The new source code is here and I think it's a hell of an improvement.
This is the old source code for comparison.
That took a while, but it was totally worth it. :)
At 7/28/12 03:40 PM, Diki wrote: Last night I spent over 6 hours refactoring my SimpleJS JavaScript framework.
The new source code is here and I think it's a hell of an improvement.
This is the old source code for comparison.
That took a while, but it was totally worth it. :)
Wow... You certainly have talent. I don't know how a man can have nerves to make over 1000 lines of code. Congrats!
And for what did you make that framework? For a school project or something?
At least not a muffin.
At 7/28/12 05:41 PM, doodle-bread14 wrote: Wow... You certainly have talent. I don't know how a man can have nerves to make over 1000 lines of code. Congrats!
And for what did you make that framework? For a school project or something?
1,000 lines really isn't that much. A lot of that is also the comments; there's probably only about 600 lines of actual code.
And nope it's not for school; just something I made because I don't like how complicated vanilla JavaScript is, so I wrote a framework to simplify it without adding any custom wrappers like jQuery and MooTools do.
At 7/28/12 10:44 AM, doodle-bread14 wrote:At 7/28/12 10:20 AM, NinoGrounds wrote: Not really, just a lot of content.Gzzbshgmdfck... And how's the website going?
Pretty good. Still have a lot to do though.
At 7/28/12 06:44 PM, Diki wrote: just something I made because I don't like how complicated vanilla JavaScript is, so I wrote a framework to simplify it without adding any custom wrappers like jQuery and MooTools do.
That's the spirit.
Going to make a little thingy now, I think I should be finished in 2 hours. Then I'll post it here.
At 7/28/12 09:36 PM, NinoGrounds wrote: Going to make a little thingy now, I think I should be finished in 2 hours. Then I'll post it here.
2 hours my ass. I just spent 5 and half hours and I'm still on like 1/2. to be contiuned
At 7/29/12 03:35 AM, NinoGrounds wrote:At 7/28/12 09:36 PM, NinoGrounds wrote: Going to make a little thingy now, I think I should be finished in 2 hours. Then I'll post it here.
That white/blue combination is very heavy on the eyes while reading.
Try this
At 7/28/12 06:44 PM, Diki wrote: 1,000 lines really isn't that much. A lot of that is also the comments; there's probably only about 600 lines of actual code.
And nope it's not for school; just something I made because I don't like how complicated vanilla JavaScript is, so I wrote a framework to simplify it without adding any custom wrappers like jQuery and MooTools do.
I couldn't do better. And why does the code look similar to AS3?
To Ninogrounds:
kiwi-kiwi is right. The blue/white combination really stings the eyes. You could try the dark blue/light blue combination.
At least not a muffin.
At 7/29/12 07:37 AM, doodle-bread14 wrote: I couldn't do better. And why does the code look similar to AS3?
Dialects of EMCAScript.
At 7/29/12 07:37 AM, doodle-bread14 wrote: kiwi-kiwi is right. The blue/white combination really stings the eyes. You could try the dark blue/light blue combination.
At 7/29/12 05:34 AM, kiwi-kiwi wrote: That white/blue combination is very heavy on the eyes while reading.
Try this
tell me about it. but that's what the employer wanted, because that are "their colors"
At 7/29/12 02:29 PM, NinoGrounds wrote: tell me about it. but that's what the employer wanted, because that are "their colors"
Very well then.
At least not a muffin.
At 7/29/12 05:41 PM, NinoGrounds wrote: thank me later
Wow! Just wow!
I'm guessing he bought it from this chick whom I found out about a few weeks ago.
Some guys are pretty damn desperate to have a girl touch them.
At 7/29/12 06:30 PM, Jessii wrote:At 7/29/12 05:41 PM, NinoGrounds wrote: thank me laterWow! Just wow!
I know, I know
At 7/29/12 07:22 PM, Diki wrote: I'm guessing he bought it from this chick whom I found out about a few weeks ago.
Some guys are pretty damn desperate to have a girl touch them.
I strongly suggest that we LOIC that site
At 7/29/12 07:22 PM, Diki wrote: I'm guessing he bought it from this chick whom I found out about a few weeks ago.
Reminds me of this.
At 7/29/12 08:10 PM, liljim wrote:At 7/29/12 07:22 PM, Diki wrote: I'm guessing he bought it from this chick whom I found out about a few weeks ago.Reminds me of this.
Yeah he's an idiot. But aside from that, I just noticed that YT video are now embed. Nice work.
IE is a fucking moron, even if its newest version (10, it comes with win8).
Any suggestions on how to fix this site ? It looks fine in Chrome and FF
Linky to hi res: http://img687.imageshack.us/img687/1002/capturelqr.png
At 7/30/12 09:33 PM, NinoGrounds wrote: IE is a fucking moron, even if its newest version (10, it comes with win8).
Any suggestions on how to fix this site ? It looks fine in Chrome and FF
Linky to hi res: http://img687.imageshack.us/img687/1002/capturelqr.png
At 7/29/12 08:10 PM, liljim wrote:At 7/29/12 07:22 PM, Diki wrote: I'm guessing he bought it from this chick whom I found out about a few weeks ago.Reminds me of this.
Ahah. Definitely some weird folks out there.
And for the record, I don't know what show that is, but I saw Ricky Gervais, and Ricky Gervais is awesome.
At 7/30/12 09:33 PM, NinoGrounds wrote: IE is a fucking moron, even if its newest version (10, it comes with win8).
Any suggestions on how to fix this site ? It looks fine in Chrome and FF
Linky to hi res: http://img687.imageshack.us/img687/1002/capturelqr.png
As someone whose job it is to make websites I completely agree that IE is an absolute pile of shit, but unfortunately if you want to make websites or a living you have to learn how IE works.
I tried loading that site in IE9 and it certainly seems to be loading incorrectly; I do not know why though. Best advice I can give for writing IE compliant HTML is to treat your page like a series of boxes, and each box does not contain elements that extend its boundaries. IE doesn't like that.
At 7/30/12 10:54 PM, Diki wrote: and each box does not contain elements that extend its boundaries. IE doesn't like that.
thanks