cmaloney | Evening | 00:19 |
---|---|---|
cmaloney | Jeez; this is valid JavaScript: var array = [2,3,4,5,6]; console.log(array['length']); | 00:52 |
cmaloney | array['length'] = 34; | 00:53 |
cmaloney | array.length; // 34 | 00:53 |
cmaloney | Oh, it gets better: | 00:54 |
cmaloney | listOfNumbers | 00:55 |
cmaloney | [ 2, 3, 4, 5, 6, , , , , , , , , , , , , , , , , , , , , , , , , , , , , ] | 00:55 |
cmaloney | *eyeroll* | 00:55 |
cmaloney | > listOfNumbers['length'] = 2 | 00:56 |
cmaloney | 2 | 00:56 |
cmaloney | > listOfNumbers | 00:56 |
cmaloney | [ 2, 3 ] | 00:56 |
cmaloney | y | 00:56 |
cmaloney | Hope you didn't like that data | 00:56 |
Zimdale | hahahaha | 01:02 |
Zimdale | good o'le javascript | 01:02 |
Zimdale | just change it to console.log`array['length']` because we don't care about looking readable ;) | 01:03 |
Zimdale | oh wait that actually doesn't work the way I thought | 01:05 |
Zimdale | oh well | 01:05 |
Zimdale | That is interesting though, should make a thing that just scans through all window variables that are arrays and changes the length. | 01:09 |
Zimdale | Just to make some developer's lives hell | 01:10 |
cmaloney | Yeah, and storing dimensions['length', 'width', 'height'] is going to make thing strange | 01:10 |
Zimdale | hahaha | 01:11 |
Zimdale | If only there were alternatives to javascript | 01:12 |
cmaloney | > bar = ['width', 'height'] | 01:13 |
cmaloney | [ 'width', 'height' ] | 01:13 |
cmaloney | > bar.indexOf['length'] | 01:13 |
cmaloney | 1 | 01:13 |
jrwren | but... that is... normal. | 01:15 |
jrwren | its defined in the lang... its just not expected. | 01:15 |
Zimdale | I think making lenght maluable is super fucking weird though | 01:17 |
Zimdale | > var arr = []; arr.length = 1000; console.log( arr.length ); | 01:17 |
Zimdale | At least you can't set arr.length to "Infinity" | 01:19 |
jrwren | its super weird. the whole language is wierd, but at least it has a definition and we can use it. | 01:19 |
Zimdale | And it's pretty easy to pick up and use | 01:21 |
cmaloney | http://decafbad.net/2016/12/28/stupid-javascript-tricks/ | 01:24 |
cmaloney | morning | 14:37 |
jrwren | https://docs.python.org/3.5/howto/sorting.html#sortinghowto does anyone know how to use sorted() to say order Desc on the first key but Asc on the secodn key? | 18:54 |
jrwren | i guess i could fall back to cmp for that. meh. | 18:54 |
jrwren | nevermind, just map that field to an inverse value. <3 python | 19:01 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!