Gentleman: Oh right, i skipped the first question
Madalinski: Rather, i think maps would be faster for this
Hauskins: Django_, yes, the $http.jsonp “runs in the background”, so it hasn’t finished just yet by the time you call console.log$scope.testme
Lentsch: Pikul: how do i fix this?
Falvey: My whole program is based off the http call
Sandoval: You either continue down the callback path
Cilva: Or you start using promises
Hasselkus: What framework are you using?
Younis: Gentleman: But the whole point is that I’m adding elements to that array.
Gentleman: Undrinkablesoup: right, why?
Gentleman: Undrinkablesoup: i’m suggesting that your program would be designed better, and would work better, if you didn’t do that :-
Wingett: Gentleman: Because it’s the data structure that contains the items.
Tomasello: If I make a local copy and add to that, it. won’t change the real data structure.
Gentleman: Undrinkablesoup: so instead of having something point to the same array, and keep making changes to it – like it’s a big global variable – use functions, that accept an array, and return a new array
Rivelli: Anyone have ideas about looking up variable lookups in snippits of javascript? For example. Given something like “foo.bar = bazfizz”, how should I go about detecting that foo, baz, and fizz were referenced? The goal is to make my expressions in a templating language fancier.
Gentleman: Undrinkablesoup: i’m saying you shouldn’t have one “real data structure”
Korsen: Well, it *is* a global variable.
Adessa: I know a lot of programmers hate global variables, but they are beautiful IMO.
Gentleman: Undrinkablesoup: lol if you have a global variable you’ve already thrown readability, maintainability, and the last 10 years of best practices out the window, so ¯_ツ_/¯
Fallis: Are there any pure javascript codes ? i want to learn so that i could code for my android device. thanks. i am using DroidScript google play Store thanks
Ereaux: Django_, $http.jsonp returns a promise which you could use
Caronna: Gentleman: What can I say? I don’t get why you hate global variables.
Underdown: I hate shuffling data around and making everything so damn abstract.
Mate: Smgs: Eloquent JavaScript is a comprehensive introductory Web-based book with examples and a built-in interpreter. http://eloquentjavascript.net/
Gentleman: Undrinkablesoup: because i’m a programmer with more than zero experience?
Atwood: Pikul: where can i read about promises
Fallis: GreenJello: yup i did read that :.
Mate: Undrinkablesoup: Globals: not even once! It’s best to avoid global variables. As variables lose scope, they will be eligible for garbage collection. If they are scoped globally, then they will not be eligible for collection until the global namespace loses scope e.g. when the page unloads. See also !IIFE
Potier: Smgs, and you understand it?
Gentleman: That’s just a performance reason they’re awful. but there’s many more.
Fallis: GreenJello: thanks. testing the first sample code there. thanks
Cannady: Django_, to use them?
Deangelis: Also, it’s annoying that I can do “php.net/whatever” to get to official do***entation on PHP stuff, but I have to open my “MozDev” link and manually input a search term to get to not-really-official-at-all do***entation on JS.
Sucgang: Pikul: idk what a promose is
Mellison: Here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
Corrado: Well, of course I’m not making random variables global for no reason. I only use them for variables that. are. global.
Prato: Undrinkablesoup: You could read the Ecmasrcript standards. But they’re kinda **** for beginners
Gentleman: Undrinkablesoup: http://mdn.io/whatever
Tablada: Like, “var masterContainerOfItems = ;” in the beginning of the script, and then all functions can refer to that one and add items or remove them.