Pae: Why would it not let you?
Sambrook: Keitsock: Still, e.g. on ios there is nothing like react but if you will just rerender everything, it’s gonna be slow, so you gotta be smart withou your updates. in the ui code
Keitsock: You can define a variable in a higher scope and then you can define another variable with the same name in a lower scope
Wassmann: Sambrook what you mean is he Chinese? lol he’s Russian. and it’s spelled Dostoyevsky
Mulderig: In other languages var x = fx means “ take the x in the outside scope, apply f, and ***ign it to a new local x”
Keitsock: Var x = 0; function foo { var x = 5; console.logx; } foo; x // 0
Pae: Palomer: which other language? i’ve never seen that work that way
Keitsock: In JS scope has nothing to do with runtime p***ing of variables
Keitsock: In js fx means take the value of x, p*** it as a new variable in the arguments list for f
Cronce: Sambrook ahh I meant to say Dostoevsky* lol
Buboltz: Keitsock: omg, why doesn’t it output the local x?
Sambrook: AramKaram: The name has only a correct spelling in russian though. everything else is just an approximation and there is not one way
Keitsock: Palomer: sorry it would output 5, but the x at teh end is still 0
Keitsock: Var x = 0; function foo { var x = 5; console.logx; } foo; console.logx; // 5, 0
Keitsock: When you operate on variable foo, it looks in the current scope for foo. if none is found, it goes up a scope and repeats that process
Joerling: Sambrook might be, can’t argue, don’t know much about it, I was just thinking of Fyodor Dostoevsky and thats how they spell in Russian, but yeah there could be variety of spellings I guess :
Mezzinni: Var x = {expression containing x} —why would it ever make sense to have those 2 x’s refer to the same thing?
Yant: Palomer: because it’s awesome
Keitsock: Palomer: not sure what you mean
Yant: There are languages where you can write “def foo := 1, 2, foo” and have a self-referencing array
Keitsock: Scope is a function thing
Yant: JS isn’t one of them though
Keitsock: And scope happens at declaration time, not runtime
Abigantus: Damn it. I can’t even see how reduce works in this situation. http://jsfiddle.net/3kry3bdm/1/ how does even reduce helps doing this. this is the first time ever my seeing reduce doing anything else other than adding numbers together lol
Wuori: Var x = 1; {var x = x + 1;} // I would think the local x would be 2
Keitsock: Not sure what you are trying to express with those curly braces there palomer
Keitsock: But as I said, the only thing that declares scope in js is a function
Edgett: Var x = 1; function {var x = x+1;}
Cone: Keitsock i think there a couple more now
Yant: Keitsock: for ‘var’ anyway
Sambrook: AramKaram: English tends to be pretty dumb about integrating foreign words though. e.g. for arabic words, in english you always have the “al” which just is an article like “the”. so you have al gebra and al quaeda however you spell that and al cohol. which is saying like “the maths” “the fundament” “the powder”. other languages have a more systematic approach to integrating foreign words, e.g. chinese
Keitsock: Var declaration is hoisted palomer
Schrandt: Sorry, was using c++ syntax
Werkheiser: Hello. How can I efficiently store and look up things by a non-scalar, like a two-dimensional coordinate?
Keitsock: Palomer: you can think of that like var x; x = x + 1;
Werkheiser: Object properties seem to be pretty slow
Keitsock: After var x; x is undefined
Cressell: Does anyone know a tool or have an idea of how to automatically insert missing semicolons? I write semicolon-less code, but my new team requires semicolons and they’re really painful to add for me. Any ideas?
Keitsock: So then x = undefined + 1;