Giter Club home page Giter Club logo

ka_javascript's Introduction

KA_JavaScript

KhanAcademy JavaScript Interview Project (in progress)

Deployed to Heroku at: http://khanacademy-jstest.herokuapp.com/ [LINK IS ABOVE]

Initial setup :

1 - npm install
2 - npm install -g bower
3 - bower install

In separate tabs run :

4 - mongod (to start mongo)
5 - node server.js (to start server)
6 - sh bin/compile_coffee.sh (to compile coffeescript files)

Navigate to localhost:8080 in browser to use application

===========

This application allows the user to select a set of restrictions to be set on JavaScript code.

The restrictions are:

1 - Require a variable declaration
2 - Require the use of an if statement
2a - require a for loop within the if statement
2b - require a while loop within the if statement
3 - Require the use of a for loop
3a - require an if statement within the for loop
3b - require a while loop within the for loop
4 - Require the use of a while loop
4a - require a for loop in the while loop
4b - require an if statement in the while loop

5 - Do not allow a variable declaration
6 - Do not allow the use of an if statement
7 - Do not allow the use of a for loop
8 - Do not allow the use of a while loop

The user is then allowed to write JavaScript code in an embedded text editor and their code is compared to their restrictions, live. All errors are signified in red text at the bottom of the page; once all errors are fixed a green success message is displayed.

Sample Code Snippets that can be used to test (or try writing your own code!):

Variable Declaration:

`var x = 12;`    

If Statement:

if (time < 20) {
	greeting = "Good day";
	for (i = 0; i < cars.length; i++) { 
    	text += cars[i] + "<br>";
	}
	while (i < 10) {
    	text += "The number is " + i;
    	i++;
	}
}         

For Loop:

for (i = 0; i < cars.length; i++) { 
    text += cars[i] + "<br>";
    if (time < 20) {
        greeting = "Good day";
    }
    while (i < 10) {
        text += "The number is " + i;
        i++;
    }
}

While Loop:

while (i < 10) {
    text += "The number is " + i;
    i++;
    for (i = 0; i < cars.length; i++) { 
        text += cars[i] + "<br>";
    }
    if (time < 20) {
        greeting = "Good day";
    }
}

===========

Built using Angular.js and Node.js written in CoffeeScript with a MongoDB database (not used, but capable of being used if project is expanded upon), and HTML/CSS. Dependencies setup using NPM and Bower.

Used Acorn to parse the JavaScript mainly because of the superior documentation and the ease of setup with Node.

Used CodeMirror in place of a standard HTML textarea for aesthetic appeal and built-in JavaScript formatting capabilities.

===========

Tested and working in Google Chrome, Safari, and Mozilla Firefox, IE

===========

DJ Jagannathan
19 August 2014

ka_javascript's People

Contributors

desjag avatar deej122 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.