Discuss Scratch

AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

This is a forum for JS tutorials so people can add scratch extensions with maximum ability and make scratch have many more functions. This forum will teach JS basics, DOM, BOM, conditionals and loops, api, jQuery, and finally, scratch extensions. Anyone can post a tutorial.
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

JS basics #1

JavaScript is a common programming language for web and game programming. It includes variables and functions. It is case sensitive.
You define variables like this:
var a = "hi";
You have to put the semicolon at the end.
You define functions like this:
function myFunction() {
code
}
or
var myFunction = function() {
code
}
There are also alert boxes that use the alert() function, but that will be described more in JS basics #2.
StackMasher
Scratcher
100+ posts

Scratch JS Tutorial Forum

Ok but why would anyone with commitment read a bunch of random forum posts to learn something
If you want to teach people, make a book in word/libreoffice

Last edited by StackMasher (Oct. 1, 2017 15:57:55)

TheAspiringHacker
Scratcher
100+ posts

Scratch JS Tutorial Forum

You don't need semicolons in JavaScript, but I still use them in order to avoid unexpected parses.
Sheep_maker
Scratcher
1000+ posts

Scratch JS Tutorial Forum

There are many more ways to define functions:
var myFunction=()=>{
  code
};
var myFunction=Function("code");
var myFunction=eval("(function() {code})");
var myFunction=[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]("code");
Of course, each method has its own set of uses and downsides, so use whichever one you think works best

Last edited by Sheep_maker (Oct. 1, 2017 22:30:57)

herohamp
Scratcher
1000+ posts

Scratch JS Tutorial Forum

Sheep_maker wrote:

There are many more ways to define functions:
var myFunction=()=>{
  code
};
var myFunction=Function("code");
var myFunction=eval("(function() {code})");
var myFunction=[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]("code");
Of course, each method has its own set of uses and downsides, so use whichever one you think works best


But we all know

var myFunction= function(){

}

is the best
ninjagolloyd
Scratcher
500+ posts

Scratch JS Tutorial Forum

herohamp wrote:

Sheep_maker wrote:

There are many more ways to define functions:
var myFunction=()=>{
  code
};
var myFunction=Function("code");
var myFunction=eval("(function() {code})");
var myFunction=[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]("code");
Of course, each method has its own set of uses and downsides, so use whichever one you think works best


But we all know

var myFunction= function(){

}

is the best
arrows.
ninjagolloyd
Scratcher
500+ posts

Scratch JS Tutorial Forum

AmazingMech2418 wrote:

JS basics #1

JavaScript is a common programming language for web and game programming. It includes variables and functions. It is case sensitive.
You define variables like this:
var a = "hi";
You have to put the semicolon at the end.
You define functions like this:
function myFunction() {
code
}
or
var myFunction = function() {
code
}
There are also alert boxes that use the alert() function, but that will be described more in JS basics #2.
there's much more to it the semicolon distinguishes between different command-function-whatchamacallems
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

TheAspiringHacker wrote:

You don't need semicolons in JavaScript, but I still use them in order to avoid unexpected parses.
Actually, you do need them if you're doing more than one function or an if statement and one function.
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

Sheep_maker wrote:

There are many more ways to define functions:
var myFunction=()=>{
  code
};
var myFunction=Function("code");
var myFunction=eval("(function() {code})");
var myFunction=[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]("code");
Of course, each method has its own set of uses and downsides, so use whichever one you think works best
I know. I just put a few in the forum post because those are the most used ones.
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

ninjagolloyd wrote:

AmazingMech2418 wrote:

JS basics #1

JavaScript is a common programming language for web and game programming. It includes variables and functions. It is case sensitive.
You define variables like this:
var a = "hi";
You have to put the semicolon at the end.
You define functions like this:
function myFunction() {
code
}
or
var myFunction = function() {
code
}
There are also alert boxes that use the alert() function, but that will be described more in JS basics #2.
there's much more to it the semicolon distinguishes between different command-function-whatchamacallems
I know, but some people may not know much about JS and may not understand it if I said that.
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

StackMasher wrote:

Ok but why would anyone with commitment read a bunch of random forum posts to learn something
If you want to teach people, make a book in word/libreoffice
I decided to use the forum because people can ask questions about the topic and I can answer them. Also, other people can add tutorials.
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

Wow! There are so many posts in this thread! I know there are only 12, but this is the most out of any of my forum threads! My other one is a level code sharing forum for a level creator and has 3 posts all by me.
StackMasher
Scratcher
100+ posts

Scratch JS Tutorial Forum

AmazingMech2418 wrote:

StackMasher wrote:

Ok but why would anyone with commitment read a bunch of random forum posts to learn something
If you want to teach people, make a book in word/libreoffice
I decided to use the forum because people can ask questions about the topic and I can answer them. Also, other people can add tutorials.
I don't think people adding tutorials to a single thread would be a good thing, it would be too cluttered. Asking questions could also be moved to separate threads, though for small problems I see your point
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

StackMasher wrote:

AmazingMech2418 wrote:

StackMasher wrote:

Ok but why would anyone with commitment read a bunch of random forum posts to learn something
If you want to teach people, make a book in word/libreoffice
I decided to use the forum because people can ask questions about the topic and I can answer them. Also, other people can add tutorials.
I don't think people adding tutorials to a single thread would be a good thing, it would be too cluttered. Asking questions could also be moved to separate threads, though for small problems I see your point
This forum is basically an archive of JS tutorials where anyone can add a tutorial and people can get a full understanding of JS.
linglee1
New Scratcher
1 post

Scratch JS Tutorial Forum

Check this Interactive jQuery Tutorial

http://net-informations.com/jq/default.htm


Last edited by linglee1 (Nov. 19, 2018 05:56:19)

MegaApuTurkUltra
Scratcher
1000+ posts

Scratch JS Tutorial Forum

JS Basics #1

Step 1: Don't

Please at least use Typescript (or now that it's a real thing, nearly any language will run on the web with wasm).
JS on its own is a terrible horrible no good very bad language.
AmazingMech2418
Scratcher
1000+ posts

Scratch JS Tutorial Forum

MegaApuTurkUltra wrote:

JS Basics #1

Step 1: Don't

Please at least use Typescript (or now that it's a real thing, nearly any language will run on the web with wasm).
JS on its own is a terrible horrible no good very bad language.
Then why is typescript not available on all devices? JavaScript is a great language.
TheAspiringHacker
Scratcher
100+ posts

Scratch JS Tutorial Forum

AmazingMech2418 wrote:

MegaApuTurkUltra wrote:

JS Basics #1

Step 1: Don't

Please at least use Typescript (or now that it's a real thing, nearly any language will run on the web with wasm).
JS on its own is a terrible horrible no good very bad language.
Then why is typescript not available on all devices? JavaScript is a great language.
TypeScript is a compiled language.* You're supposed to convert it to JavaScript. Besides, JavaScript portability is a myth. Web developers need to support so many different browser versions that they need to use compilers such as Babel to convert modern JavaScript into versions of JavaScript that work on older browsers.

In what world is JavaScript a “great language?” It suffers from dynamic and weak typing, weird `this` semantics, `null` and `undefined` errors, and a brittle move-fast-and-break-things ecosystem.

*Technically, the compiler/interpreter distinction is for PL implementations, not PLs themselves.

Last edited by TheAspiringHacker (Nov. 20, 2018 00:35:28)

Jonathan50
Scratcher
1000+ posts

Scratch JS Tutorial Forum

MegaApuTurkUltra wrote:

Please at least use Typescript (or now that it's a real thing, nearly any language will run on the web with wasm).
JS on its own is a terrible horrible no good very bad language.
Most of those seem like weird edge cases, which are annoying, but not actual issues…

AmazingMech2418 wrote:

Then why is typescript not available on all devices? JavaScript is a great language.
Typescript is compiled to JavaScript so it can run (just about) anywhere JS does. (Ninja'd)

Last edited by Jonathan50 (Nov. 20, 2018 00:38:12)

Powered by DjangoBB