Difference among the apps. Which is true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Difference among the apps. Which is true?

Hi, all! I'm new here, newbie in programming. And i start with Javascript first. So.. one of the difference that i've found is, in this app, we must type "document.write(example)" to see the output, but i see in other app, it must "print('example')" to see the output/result. So which is the true one? or it's all true? or it's all false? Thanks

30th Sep 2018, 10:22 AM
Radendy Bahtiar
Radendy Bahtiar - avatar
6 Answers
+ 6
In javascript print() opens the printer dialog box where you can print the current document on a paper. It has nothing to do with printing to the screen.
30th Sep 2018, 12:23 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
I think you're mixing JS with Python 3 here. Can you check once?
30th Sep 2018, 10:42 AM
Van Hohenheim
Van Hohenheim - avatar
+ 1
Both methods are available in JavaScript: https://www.w3schools.com/jsref/met_doc_write.asp https://www.w3schools.com/jsref/met_win_print.asp Most of the time, I would recommend neither because the developer is expecting to create something with substance in the DOM and not just temporary output, but it really depends on what you're actually trying to accomplish.
30th Sep 2018, 11:21 AM
Janning⭐
Janning⭐ - avatar
0
I am learning with Grasshopper app too. It's said, it's a Javascript. but, when i try javascript in this app, there's that difference. So yeah, i'm confuse right now. Is python 3 similar with Javascript?
30th Sep 2018, 10:48 AM
Radendy Bahtiar
Radendy Bahtiar - avatar
0
i don't really understand yet. But i will as the time passed by. This is my second day, so i think it's normal. Thanks, anyway
30th Sep 2018, 11:42 AM
Radendy Bahtiar
Radendy Bahtiar - avatar
0
so, only document.write() to print screen?
30th Sep 2018, 12:29 PM
Radendy Bahtiar
Radendy Bahtiar - avatar