Discuss Scratch
- Discussion Forums
- » Things I'm Making and Creating
- » Java/JavaScript Topic
- Arbiter1227
-
Scratcher
100+ posts
Java/JavaScript Topic
This is a Topic for all things Java (and JS).
Share source, help, and talk with other enthusiasts!
Feel free to post your source code directly or link a repository from a site like GitHub or Repl.it
If you need to contact me, please comment on my profile.
Don't post stuff that might get you banned, be nice, and have fun!
And yes, guys, I know that there's a difference between Java and JavaScript.
Share source, help, and talk with other enthusiasts!
Permitted Languages:
- Java
- JavaScript
- Node.js
Feel free to post your source code directly or link a repository from a site like GitHub or Repl.it
If you need to contact me, please comment on my profile.
Don't post stuff that might get you banned, be nice, and have fun!
And yes, guys, I know that there's a difference between Java and JavaScript.
Last edited by Arbiter1227 (May 5, 2021 01:56:20)
- Arbiter1227
-
Scratcher
100+ posts
Java/JavaScript Topic
Here's a link to a JS adaptation of a rock-paper-scissors game someone wrote in C.
It's pretty simple, but I'm proud of it.
It's pretty simple, but I'm proud of it.
- Vaibhs11
-
Scratcher
1000+ posts
Java/JavaScript Topic
the only java script I know
<button Onclick="alert('Done bro')">Do tasks</button>Last edited by Vaibhs11 (Nov. 23, 2020 07:59:12)
- Arbiter1227
-
Scratcher
100+ posts
Java/JavaScript Topic
Only java script I knowNice

Last edited by Arbiter1227 (Nov. 22, 2020 18:30:38)
- Arbiter1227
-
Scratcher
100+ posts
Java/JavaScript Topic
nothe only java script I knowNice
browser JS is still JS lol
- SquirreIstar
-
Scratcher
1000+ posts
Java/JavaScript Topic
Ehh, I'd like to point out that Java and JavaScript aren't related. They're completely different languages.
- Arbiter1227
-
Scratcher
100+ posts
Java/JavaScript Topic
Ehh, I'd like to point out that Java and JavaScript aren't related. They're completely different languages.
Oh, no way!
- -Charon-
-
Scratcher
1000+ posts
Java/JavaScript Topic
Ehh, I'd like to point out that Java and JavaScript aren't related. They're completely different languages.that's very true. They have completely different syntax and are used for completely different things. @liamdadude has given more information as to their differences below this post
I've already learned JavaScript, but I need to brush up on it considerably (along with HTML and CSS).
I'm considering learning Java for USACO, but C++ is tempting me more
Last edited by -Charon- (Nov. 30, 2020 01:00:11)
- liamdadude
-
Scratcher
500+ posts
Java/JavaScript Topic
It's true! For starters, Java is designed for lower level actions, like communicating with hardware, and javascript is mostly for web. Also JavaScript is a scripting language, unlike java, which is a programming language. Javascript syntax is more relaxed than Java syntax. Also, Java applications can be standalone and support Multithreading, and uses more memory (RAM) then javascript.Ehh, I'd like to point out that Java and JavaScript aren't related. They're completely different languages.
Oh, no way!
thanks for reading my rant lol
-liamdadude
- RedWasNotTheImp0stor
-
Scratcher
16 posts
Java/JavaScript Topic
What are the best resources to learn javascript? Books, websites etc. I would also like to learn multiple languages after that: Python, Java, CSS, C++, C
- liamdadude
-
Scratcher
500+ posts
Java/JavaScript Topic
What are the best resources to learn javascript? Books, websites etc. I would also like to learn multiple languages after that: Python, Java, CSS, C++, CJavaScript.info
- -Charon-
-
Scratcher
1000+ posts
Java/JavaScript Topic
What are the best resources to learn javascript? Books, websites etc. I would also like to learn multiple languages after that: Python, Java, CSS, C++, CI use Codecademy and Coursera for all of these languages. KhanAcademy has a nice HTML/CSS course, which also teaches JavaScript. Harvard's CS50 is a good place to learn C and a little bit of Python.
I don't know much in the way of books, but there's a big, very informative Python book I have somewhere. I'll have to check its name
- gosoccerboy5
-
Scratcher
1000+ posts
Java/JavaScript Topic
What are the best resources to learn javascript? Books, websites etc. I would also like to learn multiple languages after that: Python, Java, CSS, C++, Cdeveloper.mozilla.org w3schools.com khanacademy.org
Anyways, cool that this topic is here. I know a tiny bit but not much, but I'm still trying to learn
(I do know that java ≠ javascript and I think node.js is not a language in its own right)
bump? is that allowed?
Last edited by gosoccerboy5 (Jan. 25, 2021 22:03:32)
- gosoccerboy5
-
Scratcher
1000+ posts
Java/JavaScript Topic
<html> <head> <title>Rock Paper Scissors</title> </head> <body> <button onclick="{let gameOptions = ['rock', 'paper', 'scissors'];let playerTimesWon = 0;alert('We\'re gonna play Rock Paper Scissors. If you want to quit at any time just enter \'quit\'. :-)');function winStatus(playerChoice, opponentChoice) {if (playerChoice == 'rock') { if (opponentChoice == 'rock') { return 'tied';} else if (opponentChoice == 'paper') {return 'lost';} else { return 'won'; }} else if (playerChoice == 'paper') {if (opponentChoice == 'rock') {return 'won';} else if (opponentChoice == 'paper') { return 'tied';} else { return 'lost'; }} else {if (opponentChoice == 'rock') {return 'lost';} else if (opponentChoice == 'paper') {return 'won';} else { return 'tied'; }}}function rockPaperScissors() {let i = prompt('How many times do you want to play?');let computerChoice;let myChoice;for (let j = 1; j <= i; j++) {myChoice = prompt('What is your choice?').toLowerCase();if (myChoice == 'quit') {break;}computerChoice = gameOptions[Math.floor(Math.random() * 3)];if (winStatus(myChoice, computerChoice) == 'won') {playerTimesWon++;}alert('The computer chose ' + computerChoice + '\nso you have ' + winStatus(myChoice, computerChoice) + '!! \nYou have won ' + playerTimesWon + ' times, and played ' + j + ' times.');}}rockPaperScissors();alert('Thanks for playing, hope you had a great time! ;)');}">Rock Paper Scissors!</button> </body> </html>
{ let gameOptions = ['rock', 'paper', 'scissors']; let playerTimesWon = 0; alert('We\'re gonna play Rock Paper Scissors. If you want to quit at any time just enter \'quit\'. :-)'); function winStatus(playerChoice, opponentChoice) { if (playerChoice == 'rock') { if (opponentChoice == 'rock') { return 'tied'; } else if (opponentChoice == 'paper') { return 'lost'; } else { return 'won'; } } else if (playerChoice == 'paper') { if (opponentChoice == 'rock') { return 'won'; } else if (opponentChoice == 'paper') { return 'tied'; } else { return 'lost'; } } else { if (opponentChoice == 'rock') { return 'lost'; } else if (opponentChoice == 'paper') { return 'won'; } else { return 'tied'; } } } function rockPaperScissors() { let i = prompt('How many times do you want to play?'); let computerChoice; let myChoice; for (let j = 1; j <= i; j++) { myChoice = prompt('What is your choice?').toLowerCase(); if (myChoice == 'quit') { break; } computerChoice = gameOptions[Math.floor(Math.random() * 3)]; if (winStatus(myChoice, computerChoice) == 'won') { playerTimesWon++; } alert('The computer chose ' + computerChoice + '\nso you have ' + winStatus(myChoice, computerChoice) + '!! \nYou have won ' + playerTimesWon + ' times, and played ' + j + ' times.'); } } rockPaperScissors(); alert('Thanks for playing, hope you had a great time! ;)'); }
) (Can someone help me make it so I'm not using brute force to determine if you won or not)Oh, and recent edit, I included everything in a block so the console doesn't throw a "redeclaration of let variable" error, maybe I should just use var, idk
Another edit I misplaced the curly brackets XD
Last edited by gosoccerboy5 (Feb. 13, 2021 18:16:27)
- Discussion Forums
- » Things I'm Making and Creating
-
» Java/JavaScript Topic