Discuss Scratch
- ScratchDiogoh
-
Scratcher
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
-
Scratcher
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
-
Scratcher
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
-
Scratcher
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
-
Scratcher
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
-
Scratcher
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
-
Scratcher
1000+ posts
JavaScript Topic
Let's continue!I… don't think anything I do will make that not be a syntax errorWhen Scratch is var (function(2.000.000) move 75 steps if <Scratch> else <Scratch*> 6n´´`` pi
- ScratchDiogoh
-
Scratcher
1000+ posts
JavaScript Topic
Errors of synthesis are for example: ´´, /…Let's continue!I… don't think anything I do will make that not be a syntax errorWhen Scratch is var (function(2.000.000) move 75 steps if <Scratch> else <Scratch*> 6n´´`` pi
- ninjagolloyd
-
Scratcher
500+ posts
JavaScript Topic
…do you know what javascript is?Errors of synthesis are for example: ´´, /…Let's continue!I… don't think anything I do will make that not be a syntax errorWhen Scratch is var (function(2.000.000) move 75 steps if <Scratch> else <Scratch*> 6n´´`` pi
- TheAspiringHacker
-
Scratcher
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
-
Scratcher
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
-
Scratcher
1000+ posts
JavaScript Topic
You did not put JS! Was it to fool us?Yes, this is why they said “sarcasm”
Last edited by dude341 (May 30, 2018 20:48:41)
- ScratchDiogoh
-
Scratcher
1000+ posts
JavaScript Topic
What's?You did not put JS! Was it to fool us?Yes, this is why they said “sarcasm”
- dude341
-
Scratcher
1000+ posts
JavaScript Topic
Sarcasm basically means a joke.What's?You did not put JS! Was it to fool us?Yes, this is why they said “sarcasm”
- ScratchDiogoh
-
Scratcher
1000+ posts
JavaScript Topic
I have not seen!Sarcasm basically means a joke.What's?You did not put JS! Was it to fool us?Yes, this is why they said “sarcasm”
- TheAspiringHacker
-
Scratcher
100+ posts
JavaScript Topic
Maybe ScratchDiogoh meant that I chose Haskell, not JS, as the syntax highlighting?You did not put JS! Was it to fool us?Yes, this is why they said “sarcasm”
- MegaApuTurkUltra
-
Scratcher
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
-
Scratcher
100+ posts
JavaScript Topic
JS tends to be weirdI prefer y++ haskal:0 <= 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
-
Scratcher
1000+ posts
JavaScript Topic
The check happens at compile-time! Therefore, y++ haskal > Racket!non_sequitur.png
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!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.
Last edited by MegaApuTurkUltra (May 31, 2018 03:03:38)
- TheAspiringHacker
-
Scratcher
100+ posts
JavaScript Topic
It is a good thing!The check happens at compile-time! Therefore, y++ haskal > Racket!non_sequitur.pngAlso, 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!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.
- () 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)







