Discuss Scratch
- ScratchDiogoh
-
1000+ posts
JavaScript Topic
Thanks to Scratch Team for being a Friend of this Topic
We can use the tag code js To Discuss JavaScript
We can use the tag code js To Discuss JavaScript
<html> var x = 200 <body class> if <class> var y = 899 deslike hot var = 97 cold var old var </html>
- LuckyLucky7
-
1000+ posts
JavaScript Topic
list = ["ScratchCat"] alert("Scratch Cat was here") list.pop("ScratchCat")
Last edited by LuckyLucky7 (May 24, 2018 11:15:42)
- ACE009
-
100+ posts
JavaScript Topic
Uh, you got pop and list backwards in the third line, it's list.pop() (since pop is a method of list, not list is a method of pop).I learned JavaScript before but I kind of don't remember everything about it.list = ["ScratchCat"] alert("Scratch Cat was here") pop.list("ScratchCat")
- LuckyLucky7
-
1000+ posts
JavaScript Topic
OkUh, you got pop and list backwards in the third line, it's list.pop() (since pop is a method of list, not list is a method of pop).I learned JavaScript before but I kind of don't remember everything about it.list = ["ScratchCat"] alert("Scratch Cat was here") pop.list("ScratchCat")
Last edited by LuckyLucky7 (May 24, 2018 11:14:49)
- NickyNouse
-
1000+ posts
JavaScript Topic
This code should make the above code work correctly:Uh, you got pop and list backwards in the third line, it's list.pop() (since pop is a method of list, not list is a method of pop).I learned JavaScript before but I kind of don't remember everything about it.list = ["ScratchCat"] alert("Scratch Cat was here") pop.list("ScratchCat")
(function() { window.pop = window; let _list = []; Object.defineProperty(pop, 'list', { get: () => { return item => { let index = _list.indexOf(item); if(index > -1) { _list.splice(index, 1); return item; } else { throw new ReferenceError(`"${item}" is not in pop.list`); } } }, set: newList => { if(Array.isArray(newList)) { _list = newList; } else { _list.push(newList); } } }); })();
- ScratchDiogoh
-
1000+ posts
JavaScript Topic
Let's continue!This code should make the above code work correctly:Uh, you got pop and list backwards in the third line, it's list.pop() (since pop is a method of list, not list is a method of pop).I learned JavaScript before but I kind of don't remember everything about it.list = ["ScratchCat"] alert("Scratch Cat was here") pop.list("ScratchCat")(function() { window.pop = window; let _list = []; Object.defineProperty(pop, 'list', { get: () => { return item => { let index = _list.indexOf(item); if(index > -1) { _list.splice(index, 1); return item; } else { throw new ReferenceError(`"${item}" is not in pop.list`); } } }, set: newList => { if(Array.isArray(newList)) { _list = newList; } else { _list.push(newList); } } }); })();
When Scratch is var (function(2.000.000) move 75 steps if <Scratch> else <Scratch*> 6n´´`` pi

- NickyNouse
-
1000+ posts
JavaScript Topic
I… don't think anything I do will make that not be a syntax error Let's continue!When Scratch is var (function(2.000.000) move 75 steps if <Scratch> else <Scratch*> 6n´´`` pi
- ScratchDiogoh
-
1000+ posts
JavaScript Topic
Errors of synthesis are for example: ´´, /…I… don't think anything I do will make that not be a syntax error Let's continue!When Scratch is var (function(2.000.000) move 75 steps if <Scratch> else <Scratch*> 6n´´`` pi
- ninjagolloyd
-
500+ posts
JavaScript Topic
…do you know what javascript is?Errors of synthesis are for example: ´´, /…I… don't think anything I do will make that not be a syntax error Let's continue!When Scratch is var (function(2.000.000) move 75 steps if <Scratch> else <Scratch*> 6n´´`` pi
- TheAspiringHacker
-
100+ posts
JavaScript Topic
var pooh ===== tigger; oof(oww; my) { bones;; xdd } std::System.out.console.cout << "Bone hurting juice" <<<<< std::flush; (putStrLn "Ouchie") >> (putStrLn $ show pooh)
/sarcasm
Last edited by TheAspiringHacker (May 29, 2018 23:04:06)
- ScratchDiogoh
-
1000+ posts
JavaScript Topic
You did not put JS! Was it to fool us?Like my JS? :^)var pooh ===== tigger; oof(oww; my) { bones;; xdd } std::System.out.console.cout << "Bone hurting juice" <<<<< std::flush; (putStrLn "Ouchie") >> (putStrLn $ show pooh)
/sarcasm
- dude341
-
1000+ posts
JavaScript Topic
Yes, this is why they said “sarcasm” You did not put JS! Was it to fool us?
Last edited by dude341 (May 30, 2018 20:48:41)
- ScratchDiogoh
-
1000+ posts
JavaScript Topic
What's?Yes, this is why they said “sarcasm” You did not put JS! Was it to fool us?
- dude341
-
1000+ posts
JavaScript Topic
Sarcasm basically means a joke.What's?Yes, this is why they said “sarcasm” You did not put JS! Was it to fool us?
- ScratchDiogoh
-
1000+ posts
JavaScript Topic
I have not seen!Sarcasm basically means a joke.What's?Yes, this is why they said “sarcasm” You did not put JS! Was it to fool us?
- TheAspiringHacker
-
100+ posts
JavaScript Topic
Maybe ScratchDiogoh meant that I chose Haskell, not JS, as the syntax highlighting?Yes, this is why they said “sarcasm” You did not put JS! Was it to fool us?
- MegaApuTurkUltra
-
1000+ posts
JavaScript Topic
JS tends to be weird
I prefer racket
0 <= null true 0 >= null true 0 == null false 0 === null false
I prefer racket
(<= 0 '()) ; <=: contract violation ; expected: real? ; given: '() ; argument position: 2nd
- TheAspiringHacker
-
100+ posts
JavaScript Topic
I prefer y++ haskal: JS tends to be weird0 <= null true 0 >= null true 0 == null false 0 === null false
I prefer racket(<= 0 '()) ; <=: contract violation ; expected: real? ; given: '() ; argument position: 2nd
Prelude> 0 <= ()
<interactive>:1:1: error:
• No instance for (Num ()) arising from the literal ‘0’
• In the first argument of ‘(<=)’, namely ‘0’
In the expression: 0 <= ()
In an equation for ‘it’: it = 0 <= ()
Also, I see that you are using '() as an equivalent of null! y++ haskal has (), Nothing, and [] for you to choose from based on the meaning!
Last edited by TheAspiringHacker (May 31, 2018 03:01:26)
- MegaApuTurkUltra
-
1000+ posts
JavaScript Topic
non_sequitur.png The check happens at compile-time! Therefore, y++ haskal > Racket!
And this is supposed to be a good thing? It's like JS undefined vs null vs empty array vs etc etc. Just confusing, and serves no useful purpose. Also, I see that you are using '() as an equivalent of null! y++ haskal has (), Nothing, and [] for you to choose from based on the meaning!
Last edited by MegaApuTurkUltra (May 31, 2018 03:03:38)
- TheAspiringHacker
-
100+ posts
JavaScript Topic
It is a good thing!non_sequitur.png The check happens at compile-time! Therefore, y++ haskal > Racket!And this is supposed to be a good thing? It's like JS undefined vs null vs empty array vs etc etc. Just confusing, and serves no useful purpose. Also, I see that you are using '() as an equivalent of null! y++ haskal has (), Nothing, and [] for you to choose from based on the meaning!
- () is the inhabitant of the unit type. The unit type corresponds with the True proposition in the Curry-Howard Isomorphism. However, because Haskell features nontermination, all types are also inhabited by _|_. (This flaw also applies to Racket, FYI.)
- Nothing is a constructor of Maybe, the option type. Instead of using null to represent absence of a value like in JS, you need to use Maybe, and thus must do case dianalysis/pattern matching, preventing null errors!
- [] is the constructor of the empty linked list. You, as a Racketeer, should already be familiar with the definition of the linked list.
These “null” values are all of different types and have different meanings!
Last edited by TheAspiringHacker (May 31, 2018 03:23:26)