What language is Khan Academy CS using?
Asked Answered
H

6

6

My son is playing around with Khan Academy's Computer Science and learning lots.

The application is running on JavaScript in the browser but the language doesn't quite conform to JavaScript conventions. e.g. random(low, high) rather than JavaScript's Math.random()

Does anyone know exactly what language they're using?

Is there any more complete documentation other than what's on the site link as this looks like an incomplete list of functions and methods.

Headache answered 3/3, 2013 at 20:41 Comment(2)
That's what I said. So what language is Khan Academy using and where is the full documentation?Headache
I would like to point out though that it doesn't matter much. The syntax they use is the C or Java style syntax which is the most used, also for many other languages such as C#.Calvano
G
8

I believe they just wrap it up and develop their own functions beneath which is the JavaScript.

as stated:

All of the code in the Khan Academy Computer Science platform is written using JavaScript and Processing.js.

https://www.khanacademy.org/cs/docs

Guinn answered 29/6, 2013 at 13:36 Comment(0)
J
5

This is a bit late to be of use to the original question, but good luck to anyone who may find this useful. :)

I am a CS college student and I play with KACS a lot.

The original Processing language is a subset of Java, however there is a javascript version called processing.js. The Khan Academy CS sandbox uses the processing.js library, but the sandbox itself uses plain old javascript - though there several steps that the code goes through before it is rendered in the output window on the right.

In other words the code is taken from a document editor on the left, in text form, then mulled over and injected into a sandboxed running environment on the right. The sandbox curates the environment to combine a subset of native javascript and processing.js functions (which themselves come in the form of javascript from the processing.js library).

random(a, b) is not Math.random() but rather a processing.js helper function which itself uses Math.random to give a result between a and b.

There's a bit more to it (particularly lint, some minor technical details of the KACS running environment and a few helper functions that are specific to the KACS environment and not part of processing.js), but if you want to set up your own sandbox to work kinda like what the KA sandbox does, you can download processing.js here. I made a quick and dirty sandbox by using the following code in a plain text file I named sandbox.html.

<html><head><script src="processing.min.js"></script></head><body><canvas id="output-canvas"></canvas><script>var sketch = function (processing){with(processing){size(400, 400);background(255);

// example
// fill(255, 0, 0);
// ellipse(0.5*width, 0.5*height, 100, 50);
// your code here

}};var p = new Processing(document.getElementById("output-canvas"), sketch);</script></body></html>

Then put the above file in the same folder as processing.min.js, just type your code where it says // your code here, save and open the file.

Documentation to a full list of Procesing functions is here.

Enjoy!

Judiejudith answered 23/1, 2015 at 19:0 Comment(0)
S
1

Khan Academy uses JavaScript, with the Processing JS library for drawing. Processing JS is a JavaScript port of the Processing language:

Processing is an open visualization language developed by Ben Fry & Casey Reas, and originally ported to Javascript by John Resig. Processing.js is maintained by the Processing.js team.

Sewn answered 17/8, 2014 at 4:8 Comment(0)
C
1

> Using regular Java Script, Processing Java Script, and some edits along the way, Khan Academy has created there own version of Java Script, called KAPJS.

>

Casarez answered 28/5, 2017 at 21:46 Comment(0)
P
0

Khan Academy's Javascript programs use the processing.js library. A complete list of functions included by processing.js can be found here: http://processingjs.org/reference/

Pyrography answered 23/6, 2015 at 19:40 Comment(0)
H
-1

Khanacademy uses the PJS(processing Java Script), which is a JS Library.

Hamelin answered 17/3, 2017 at 3:14 Comment(1)
This just duplicates existing answers.Cathern

© 2022 - 2024 — McMap. All rights reserved.