JavaScript tutorial (Part 1)

Mutal exclusion lock.
Used to control multithreading.

1 Like

Oh, I think there is a way to see the JS coding for the Snap! Forums website by clicking ctrl, shift and a letter.

ctrl-shift-i
edit:oof bruhy it shoulc be ctrl shift c or f12

Ehhh, it's not the console, (you can't edit anything) and plus I did this when I was blocked..... Also how did you do that fancy square thing around your text?

<kbd></kbd>

Please don't get off-topic @18001767679 @snapenilk @SuperSean12 @FUNTIME_FOXY101

1 Like

ok

@FUNTIME_FOXY101 the code snippet in your signature doesn't work.

jshdkjakjdakjdnaskj, ok, did I fix it?

No.
In correct:
return window.prompt.("What is your name?", "Funtime Foxy")
console.log("Donald Trump is Donald duck, when you turn his head upside down");
correct:
return prompt("What is your name?", "Funtime Foxy")
console.log("Donald Trump is Donald duck, when you turn his head upside down");

Think of the . as the of Sensing reporter in Snap!, but backwords.

Did I finally fix it?

2 Likes

[scratchblocks]
ignore([What is your name?Funtime foxy]of([prompt v]of[window v]))//non sensical
run([log v]of[console v])w/ inputs [Donald Trump is Donald duck, when you turn his head upside down]//behaves intended
[/scratchblocks]

Yes but no.You shouldnt put anything after a return statement
[scratchblocks]
report([What is your name?Funtime foxy]of([prompt v]of[window v]))::cap//Uh oh,next block cant attach/run
run([log v]of[console v])w/ inputs [Donald Trump is Donald duck, when you turn his head upside down]//behaves intended
[/scratchblocks]

The return statement is like
[scratchblocks]
report [] :: control cap
[/scratchblocks]

1 Like

I removed the semicolon.

Should I remove the return too?

1 Like

No,I want you to remove the return statement instead of the ;.

The console.log is still after the return statement; the interpreter will never reach the console.log.
You can remove the return statement, but the value returned by the prompt will not be used.

I deleted the whole first line. There is now only one.