5

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.

Transistor
  • 303
  • 4
  • 13

6 Answers6

7

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

marsrover
  • 424
  • 5
  • 16
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!

Nolo
  • 846
  • 9
  • 19
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.

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.

>

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/

Thomas Li
  • 1
  • 1
-1

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