Podgurski: But it means we can run myFunction with a function as an argument, like myfunctionfunction{ console.log”done” }:
Podgurski: Once you get your head around that, you”ll see that callbacks are nothing mor than functions provided to the function as an argument
Podgurski: They typically come at the end, but thats just a convention because the functions are multi-line
Dellosso: You can do that in python, python has lambda functions
Haage: Hello everyone! I wanna ask a tip. I’ve got an JSON array with more than 300 objects and i need to iterate them. What i wanna ask is what is more performant? a for loop or send from server a string representation of the array and then eval ?
Gershkovich: Send the array itself, iterate over it with array iteration methods
Gershkovich: Eval and sending strings is just silly
Spraberry: Hi. Is it better to use an object of objects instead of an array of objects, so when I want to delete an element I don’t need to do a for loop to find the one i want to remove?
Blesofsky: I can just remove the element by it’s key
Gershkovich: Chargen: you don’t need a for loop to remove things from an array either
Marson: I don’t know the index, just the key
Nantwi: Chargen: then what would be the advantage of array in your case?
Fiddelke: Chargen: in case you’re not intereseted in the order of you objects, just stick to object/hash
Lasher: I’ve done a small test and there’s almost no difference
Volk: Is there a way I can correctly p**** the json data even though I am reading it as jsonp?
Volk: I can’t figure out how to get couchbase to send me jsonp, modifying the local.ini to enable cors didnt work
Linzie: Volk: Then uh, what is it sending you?
Volk: Http://pastebin.com/HzrBmEiQ
Volk: My request what it returns http://pastebin.com/0H9BBqgk the comma ont he second entry is not there, i removed the rows below that to reduce the amount of data
Wildberger: Q: Is it OK to use arrow functions in places where you don’t actually need context binding. for the sake of shorter syntax and code readability?
Hodgdon: Hi. I am trying to initialize a nested map, where one entry of the inner map should be one of the outer map. Like this: https://jsfiddle.net/LLysupuq/
Tufano: Is there a convenient way to do that?
Pegelow: Ogradyd, what do you mean by outer map? c: map.a ?
Volk: Buu: any ideas/suggestions?
Tohen: I’m not aware of any syntax for that, other than map.b.c = map.a, whichis not particularly convenient. conceptually the whole thing also has a risk of ambiguity
Wakley: Buu: JSON – Glossary MDN https://developer.mozilla.org/en-US/docs/Glossary/JSON
Wakley: Buu: JSON.p**** – JavaScript MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/p****
Bleich: Hello_kitty: yes, that’s what I want. I tried the syntax you suggested and it yields “cannot read property of undefined”
Tuey: Oh, I see you are putting the value at the right place after the initialization
Bacho: Ogradyd, the short answer is that it can’t be done. map doesn’t exist until the end of the statement, so there is no map to refer to until map is created
Ferreyra: Hello_kitty: that’s what I feared. Thank you.
Volk: Buu: i would but then i couldn’t get any data because my couchbase doesn’t support json because it is on a different host
Linzie: Volk: what the **** is it sending then
Stonesifer: Hey guys. i need to make sure that an argument p***ed into a function is an object. since typeof null is also “object” it’s not safe to check if typeof arg === ‘object’
Torchio: So i’m currently using:
Bardos: Iftypeof spec !== ‘undefined’ && typeof spec === ‘object’ && spec !== null {
Purnell: Which is ugly. so i thought it might be a good idea to use Object.prototype.toString.callspec === ‘object Object’ instead