When the first condition is true, the code inside executes perfectly. Otherwise, nothing is getting run. Note that the same thing happens if I use an "else" instead of the second "if". Note too, if the first condition is true, then "got past" gets displayed, but if it's false, then even that line doesn't get executed.
This is my first time with javascript, and also my first time messing with Greasemonkey, so is there something obvious I'm missing here?
Which indicates that you get an error, for example something is undefined. Use the console to verify what happens.
Right, I got that there was an error, but I'm literally running the code above. Besides the conditions and the "alert" calls, I'm actually doing nothing (everything else is commented out), and the behavior is the same. When the condition is met, everything runs, else nothing is run. So my question is more: is there any reason why that first condition being false should mean that the rest of the code doesn't run?
Here, for reference, I am running this *exact* code (this is the entire script):
For future reference you should not just learn what match returns from this, more important is to learn that simply looking at the console would've told you exactly the same.
For future reference you should not just learn what match returns from this, more important is to learn that simply looking at the console would've told you exactly the same.
For future reference, working in GM, where can I get said console? In firefox, does the Web Dev -> Web Console do what you're talking about? Or does GM have its own debugging console? Thnx
I have never worked with GM before, so I don't know if it shows up in the console log. But even if not, just do what I did: Take your little code snippet and put it in a service like jsfiddle or writecodeonline.com.
I'd just assume that there's gonna be some sort of logging even with GM, though.