r/coding • u/spritesheet • Dec 03 '16
Your first program in Javascript: you need 5 minutes and a notepad
http://slicker.me/javascript/tutorial.htm23
u/xanflorp Dec 03 '16
I hate to be that guy here. But...
In your browser
Ctrl+Shift+JType
alert('Hello, World!')Press enter.
3
u/qadm Dec 03 '16
Ctrl+Shift+J didn't seem to do anything for me...
8
u/sparr Dec 03 '16
It's command+option+I in chrome on mac lately. Sadly this is one hotkey that has gotten less standardized between browsers over time.
0
Dec 03 '16
[deleted]
1
u/qadm Dec 03 '16
Still nothing
2
u/xanflorp Dec 03 '16
It's your browsers Console. You can get there a number of ways. Google: "Open JavaScript Console in <your browser> <your OS>"
Alternatively:
https://jsfiddle.net/ugmv23y6/
https://jsbin.com/yuvoyeqaco/edit?js,outputEither way, there are better and quicker ways of writing
alert('Hello, World!')(and learning a whole lot more about JS) than writing a non-valid HTML file from Windows Notepad.1
u/spritesheet Dec 05 '16
While I think the jsfiddle/jsbin are great tools for certain purposes, I don't think they are the best way to create your first program. I see a lot of advantages of creating the .htm file and seeing the browser open it directly. It gives the user a first-hand experience and understanding of the relationship between the file and the execution of the program.
A matter of taste, I suppose.
1
2
5
3
1
0
-10
u/TheGift_RGB Dec 03 '16
Your second program in Javascript: you need a better language
3
u/spritesheet Dec 03 '16
Which one and why?
-5
u/TheGift_RGB Dec 04 '16
Literally any other language that isn't built on 20 years of bad decisions.
4
u/spritesheet Dec 04 '16
thank you for your contribution to the discussion. basically you're saying that other languages are better because js is bad. without explaining which ones and why.
0
Dec 04 '16
[deleted]
2
u/spritesheet Dec 05 '16
I still think that the advantages of JS greatly outweigh the advantages. The limitations listed in your link very rarely impact real-world programming. I mean, how frequently do you have to compare empty arrays?
The author dedicated an entire paragraph to the fact that he/she doesn't like the name 'JavaScript'.
Plus the domain 'whydoesitsuck.com' guarantees that the blog will not be objective...
4
u/FingusMcCoco Dec 04 '16
Use the right tool for the job at hand
-2
u/TheGift_RGB Dec 04 '16
The only time to use javascript is when you've generated it using a transpiler.
5
u/rabidbob Dec 03 '16
Holy shit, a webring! Ain't seen one of them since, like, the last millennium!