« first day (1472 days earlier)      last day (3485 days later) » 

10:00 PM
maybe you could check it with an if and it is null give it a known value so you know it was null
 
@phenomnomnominal doesn't make sense, that says it called toString() on null, which null is a primitive and doesn't have methods?
 
> The abstract operation ToString converts its argument to a value of type String according to Table 13:
 
Abstract operation meaning a ToString independent of the primitive object?
 
That makes a lot more sense then
0
Q: Twilio Say Verb during a phone call

Sterling ArcherBased off of this question, it's so close to what I want. We're trying to have the Say verb trigger DURING the phone call, when both parties have established connections. Not before pickup, not after hangup, not during client ringing. <?php header('Content-type: text/xml'); ?> <Response> <D...

 
10:03 PM
if (mystring==null) { mystring="0"; }
 
No rush, but if anybody knows
@user3470815 irrelevant -- he wanted to know why ""+null returned a stringify'd "null"
 
ok sorry
 
No worries :)
 
@user3470815 I was confused by the behaviour of null.toString()
 
ok so you wanted to know how it worked internally
 
10:04 PM
indeed
spec to the rescue
 
dat spec
 
hi guys. how do you define a function parameter with a default value in js? like in php you can do:

function someFunc($param = false)
 
@NickShears Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
is it possible?
 
@NickShears can't do it
 
10:05 PM
@NickShears I don't think JavaScript supports function override
 
What's PHP?
 
var func = function (param) {
    param = param || 'default';
}
 
best you can do is inside of the function ^^ like this
 
or use CoffeeScript or TypeScript
 
Damn, nomnom too fast
 
10:06 PM
or wait for ES6
 
unless the param could be falsey, then you check typeof === 'undefined'
 
ahh i see, thanks a lot! :)
 
var func = function(param) {
  if (param == null) {
    param = 'default';
  }
};
^ coffeescript way
 
var func = function(param) {
  if (typeof param === 'undefined') {
    param = 'default';
  }
};
^ vanilla way
 
ES6 will support function derp(x = false)?
 
10:08 PM
!!google es6 argument overloading
 
@rlemon isn't undefined a primitive, not a string?
 
@SterlingArcher but typeof returns a string
!!> undefined;
 
@rlemon "undefined"
 
;)
 
10:09 PM
Ah, good call
 
@rlemon param can't throw a typeerror, so you're probably fine without the typeof
 
@SterlingArcher …
 
Why not if (param === undefined)?
 
param == undefined would work
 
@copy stow that shit yo!
@rlemon oh ok. Is one better or just preference?
 
10:10 PM
!!> console.log( typeof([]), undefined );
 
@rlemon "undefined" Logged: "object","undefined"
 
they are both strings.
but they are not the same type ??
I've confused myself now
let me grab a beer and i'll explain better
 
don't try too hard lol I'm about to leave
Get a miller 64
 
!!> typeof null
 
less calories
 
10:11 PM
@phenomnomnominal "object"
 
JAVASCRIPT!!!!!
 
!!> {}+{}
 
@SterlingArcher "NaN"
 
!!> typeof NaN
 
@phenomnomnominal "number"
 
10:12 PM
@SterlingArcher long story short, typeof produces a string. so you can't check it against the undefined object, you must check it against the expected string value
which is
!!> typeof undefined;
 
@rlemon "undefined"
 
get it?
 
Got it!
 
== coerces
== is stupid
 
@phenomnomnominal Anything else would be terribly wrong
 
10:13 PM
Now refresh my brain as to why []+[] = "" when {}+{} = NaN?
 
@copy yes, but they should rename it to NotAValidNumber
 
because arrays can be flattened into strings
 
because of the batman phenom
 
!!> [1,2,3,4,5] + [,6,7,8,9]
 
And objects can't flatten?
 
10:13 PM
@rlemon "1,2,3,4,5,6,7,8,9"
 
!!> ({1:2,3:4})+({5:6,7:8})
 
@SterlingArcher "SyntaxError: missing ; before statement"
 
@phenomnomnominal Meh, they should stick to how it's called in the IEEE standard
 
@SterlingArcher "[object Object][object Object]"
 
!!> Array(16).join("1,2" - 1) + " Batman!"
 
10:14 PM
@copy they should change the standard
 
@TravisJ "NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!"
 
So ({})+({}) works, but {}+{} returns NaN
Interesting
 
!!> "object" + {}
 
@rlemon "object[object Object]"
 
10:15 PM
!!> {}+{}
 
@rlemon "NaN"
 
!!> +{}
 
@phenomnomnominal "NaN"
 
!!> [({}) + ({}),{} + {}]
 
@rlemon ["[object Object][object Object]","[object Object][object Object]"]
 
10:15 PM
!!> +{} + {}
 
!!> +({})
 
@SterlingArcher "NaN"
@phenomnomnominal "NaN[object Object]"
 
@SterlingArcher make the {} an expression and it works
!!> {}
 
Got it
 
@rlemon "undefined"
 
10:15 PM
^
 
it isn't an object
!!> []
 
@rlemon []
 
ok, it gotta goooooooooo
byebye
!!afk home
 
!!> [].toString()
 
10:16 PM
@rlemon ""
 
!!> toString.call([])
 
@TravisJ "[object Array]"
 
!!watch moonshiners or watch something else
 
@rlemon watch moonshiners
 
Could you recommend an ide for debugging js?
 
10:20 PM
Chrome!
 
Im using firebug
 
chrome dev tools + a linter
 
that's the worst pun I've seen in years
 
how could dest be undefined :
var dest=0;
 
@KendallFrey that's despica-boo-le
 
10:25 PM
dest=destinys[z]; //destiny[z] is ["5x1"]
no i didnt forget the s on the actual code
 
@user3470815 show more code.
 
@phenomnomnominal its very messy code.. but if you still want to take a look i warned you.. jsfiddle.net/0hh9fw4m
 
ohyou.png
 
10:38 PM
@rlemon more ch3mss
 
ch3mss?
!!urban ch3mss
 
@rlemon No definition found for ch3mss
 
@user3470815 yeah I ain't gonna look at that
 
i understand @phenomnomnominal no worries
 
hello fellow geeks,

I have a python file pair.py and i have a javascript file bridge.js. I want to call a function which is in bridge.js from pair.py.

Javascript functions looks like

bridge.pairViaSetup = function pairViaSetup(pairingOptions, useUnhappyPath, AccountID,AccountPassword) { ... }

Can anyone please tell me how can i call this function in my pair.py?
 
10:44 PM
@rlemon here we have them most of the days.. massive between 7am-10am
 
12
Q: Call Javascript function from Python

KiranI am working on a web-scraping project. One of the website, I am working has the data coming from Javascript. There was a suggestion in one of my earlier question, that I can directly call the Javascript from Python. Any idea how to do it? I was not able to figure out how to call the Javascript...

 
thanks @rlemon.

I had read some answers there but couldn't get much out of them. but let me read little more deeply
 
Is it a good practice to use central timers?
 
hallo guys do you know any text editor made in Javascript that has text prediction? for example in sublime I can do "<div>...<" and when I write "/" it closes the div automatically
 
11:01 PM
visual studio web will do that
might be a bit overkill though
 
Zzzz see yaaaaa, Code hard!
 
@RobertMallow sublime text does this. Also - if you want to type fast HTML learn emmet
 
@RobertMallow webstorm does, pretty sure atom does too
 
@TravisJ thanks. thats for editing Javascript code though :)
 
11:05 PM
Isn't that what you wanted?
 
@BenjaminGruenbaum Thanks I will take a look. anyway what I meant was a web editor, made in Javascript that offered something like this
@TravisJ Nope. I searched for a web based one in Javascript
 
Ace might have auto complete?
 
looks like I have to build one myself :P
 
@RobertMallow maybe cloud 9? Although - learn emmet.
 
11:07 PM
Ah, you want a cloud based one
I think f12 provides that :)
 
@rlemon Yep you're right, I just tested it :)
@BenjaminGruenbaum I'm looking at it right now ;)
altough I need this for a site used by developers. it makes sense they have features found in offline IDE
 
it('should display commit author', function () {
  debugger;
  console.log(jQuery);
  // jQuery(ctx.element).find('div > span.commit-author').html() === 'sipa'
  expect(true).to.equal(true);
});
 
@SomeKittens amazing.
 
11:22 PM
Brilliant, innit?
 
test passes, seems legit
 
The file containing that test (and that's the only test) is 78 SLOC.
 
boom, that's some good testing.
 
11:25 PM
currently writing a UI around protractor, so our non-JS-knowing testers can write tests
working name: brotractor
 
that'd be awesome
 
@SomeKittens I flew on flight 1337 a few weeks ago
 
Did you h4x0r all teh b0x3n when you were on board?
 
11:40 PM
of course
 
what is the point of Boolean.valueOf? stackoverflow.com/q/26598618/1026459
Seemed interesting, not my question though
 
0
A: What is Boolean.valueOf in JavaScript

Benjamin GruenbaumBoolean is a function, just like String and Object, you can call it as a function to convert something to a boolean for example: Boolean(3); // true All functions in JavaScript are objects, and as objects they have a .valueOf property. Since it is a function, its valueOf isn't very meaningful ...

 
@BenjaminGruenbaum - I found it amusing that it pretty much just returns the value of Boolean. I guess I thought it would return the default value.
!!> Boolean === Boolean.valueOf()
 
@TravisJ true
 
o/
 
11:55 PM
@TravisJ edited, I hope that clarifies it
 

« first day (1472 days earlier)      last day (3485 days later) »