Skip to content

Readme + added given code to first problem #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,41 @@

- Should be rote, easy problems, to exercise mastery, rather than solving brain puzzles like other sites
- Should be solvable in under 30 seconds each


## How To Install Locally
```bash
npm i -g yarn # if you don't have yarn yet
git clone https://github.com/PracticeJavaScript/practicejavascript.com.git
cd practicejavascript.com
yarn install
yarn run watch
# Another tab
firebase serve
```

- That will build it all and watch the css, img, and js assets.
- Then you can load up `http://localhost:5000` in a browser. narf!
`/src/index.js` is the main file you'll want to edit for functionality.

## How To Add New Problems
- Problems are at `/src/problems/*.js`
- Only the asset problems are loaded for now, though we will change the problems mechanism soon to take a join of all files in it's array

Each problem must have:

- name (Not currently displayed in UI, but how we refer to unique problem)
- time (Time problem expected to solve. May be used for a timer in future.)
- prompt (UI prompt that should give user all info to solve problem. Be consise.)
- given (Given code to start problem)
- answer (Will be used to 'peek' at solved code in future UI)
- tests (Array of tests code eval will be run against)

Each test must have:

- name (appears in test list UI)
- test (assertions. returns boolean)

This test function will be run on code submission, and MUST return boolean. `output` param is available.
`output` is the output of the JavaScript evaluation of the user's code submission.
This test function may make chai.js assertions or any other comparison against the `output` value.
2 changes: 1 addition & 1 deletion public/dist/js/bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/dist/js/bundle.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/problems/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = [
name: 'Create Array',
time: 10,
prompt: "Create and return an array that contains 'apple' and 'banana'",
given: `const fruits = [];\rreturn fruits;`,
answer: `const fruits = ['apple', 'banana'];
return fruits;`,
tests: [
Expand Down