C != C
-
What does it return is the question? I don't know how to run js snippets.
-
@chris fullmer said:
What does it return is the question?
=> true
because Infinity == Infinity
@unknownuser said:
I don't know how to run js snippets.
javascript:alert((3/0)==(2/0)) in your browser location
-
@chris fullmer said:
What does it return is the question? I don't know how to run js snippets.
Ah, come on Chris...
webdialog.execute_script("your javscript here...") ;
-
I barely comprehend how Ruby can control things inside my SketchUp program. Thinking about how to execute js through ruby that is installed by SU makes my head. Which is why I have not wrapped my head around webdialogs yet. js to run html, or vice versa?, all controlled through ruby. Its like a bad nightmare
-
@chris fullmer said:
Which is why I have not wrapped my head around webdialogs yet. ... Its like a bad nightmare
Seems a little paranoiac Chris ...
-
Its a little bit more of laziness than anything.
I started reading a book on js, HTML and DOM scripting. The first 10 chapters were just the author ranting about how bad people have mis-used javascript in the past. I didn't want his bitter history report, I just wanted to learn js. Sort of put me off the language for now.
ACtually js seems straightforward enough. It was the interaction with HTML where I got quickly confused because I'm so unfamiliar with HTML, css, etc.
-
@chris fullmer said:
What does it return is the question? I don't know how to run js snippets.
My JavaScript Console runs JS, rather like Jim's WebConsole runs Ruby. Chapter 17, Reference Resources includes it, fourth tab.
The next two chapters will get you started WebDialoging, even if you know no HTML, CSS or JavaScript. Chapter 16 has a fairy tale. You might be in it.
Here's a minimal snippet tester:
<html><body><script> alert( 'put your snippet here' ) </script></body></html>
Save it as
whatever.html
and open it in your favorite browser. (Notepad++ is much smarter about HTML and JavaScript than it is about Ruby.) -
Why always so complicated?
@unknownuser said:
javascript:alert((3/0)==(2/0)) in your browser location
-
@chris fullmer said:
well now that is odd! NaN does not compare equal to itself essentially? or is it something else?
So its a really useful side-effect. You can have a line in your code:
if (a != a)
puts "its all gone pear-shaped"
endfor debugging.
-
@chris fullmer said:
I started reading a book on js, HTML and DOM scripting. The first 10 chapters were just the author ranting about how bad people have mis-used javascript in the past. I didn't want his bitter history report, I just wanted to learn js. Sort of put me off the language for now.
JS is a very permissive scripting language! People can make all sorts of mistakes and not even realize it until it's time to expand their little program into "the real world" (tm). I would highly recommend learning the basics as it can make a website much more than plain html. With the recent Google Chrome's and Firefox's very fast Canvas (graphics) rendering, JS has become even more useful.
-
@agamemnus said:
With the recent Google Chrome's and Firefox's very fast Canvas (graphics) rendering, JS has become even more useful.
I second that emotion! <canvas> is great. It's just about the most fun you can have in 2D.
Advertisement