Git Product home page Git Product logo

javascripting's Introduction

JAVASCRIPTING

Learn JavaScript by adventuring around in the terminal.

Looking for more interactive tutorials like this? Go to nodeschool.io.

Get help

Having issues with javascripting? Get help troubleshooting in the nodeschool discussions repo, on gitter or in repository issues

Also, take a look into our troubleshooting documentation

Install Node.js

Make sure Node.js is installed on your computer.

Install it from nodejs.org

Install javascripting with npm

Open your terminal and run this command:

npm install -g javascripting

The -g option installs this module globally so that you can run it as a command in your terminal.

Run the workshop

Open your terminal and run the following command:

javascripting

You'll see the menu:

javascripting screenshot

Navigate the menu with the up & down arrow keys.

Choose a challenge by hitting enter.

Take a look at this gif that shows the first challenge:

first challenge

In the gif I'm using the command line editor nano (here are some basic usage tips for nano).

You can use any editor you like.

atom or brackets are both good options.

Need help with an exercise?

Open an issue in the nodeschool/discussions repo

Include the name javascripting and the name of the challenge you're working on in the title of the issue.

Get Involved

Code contributions welcome! Please check our documentation on contributing to get started.

License

MIT

javascripting's People

Contributors

a0viedo avatar alancezararaujo avatar alexey-pd avatar anshulmalik avatar b-speer avatar ccarruitero avatar claudiopro avatar denysdovhan avatar dependabot[bot] avatar eliashjelm avatar enaqx avatar feross avatar hubgit avatar itzsaga avatar josh-austin avatar keslert avatar ledsun avatar llkats avatar marocchino avatar martinheidegger avatar michaelgrilo avatar montogeek avatar pepoviola avatar saccho avatar sethvincent avatar someoneweird avatar sudodoki avatar trott avatar victorperin avatar werikgpaula avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascripting's Issues

Cannot switch to old mode now

_stream_readable.js:749
    throw new Error('Cannot switch to old mode now.');
          ^
Error: Cannot switch to old mode now.
    at emitDataEvents (_stream_readable.js:749:11)
    at ReadStream.Readable.resume (_stream_readable.js:734:3)
    at showMenu (/Users/sethvincent/workspace/javascript-modules/nodeschool/javascripting/node_modules/workshopper-adventure/menu.js:90:17)
    at showMenu (/Users/sethvincent/workspace/javascript-modules/nodeschool/javascripting/node_modules/workshopper-adventure/exerciseMenu.js:29:10)
    at Adventure.printMenu (/Users/sethvincent/workspace/javascript-modules/nodeschool/javascripting/node_modules/workshopper-adventure/adventure.js:462:14)
    at Adventure.execute (/Users/sethvincent/workspace/javascript-modules/nodeschool/javascripting/node_modules/workshopper-adventure/adventure.js:203:8)
    at Object.<anonymous> (/Users/sethvincent/workspace/javascript-modules/nodeschool/javascripting/index.js:19:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

Looks like it is related to process.stdin.pause() / process.stdin.resume() in the menu.js file of workshopper-adventure

Maybe too much channels?

I think it would be wise to choose one entry point for newcomers to ask questions. Can you reconsider changing the gitter link to redirect to nodeschool/discussions?

javascripting does not properly install due to a dependency on an unpublished package (leichtgewicht/msee)

npm install -g javascripting
...
npm ERR! 404 Not Found
npm ERR! 404
npm ERR! 404 'leichtgewicht/msee' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 It was specified as a dependency of 'workshopper-adventure'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.

npm ERR! System Windows_NT 10.0.10565
npm ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\ProgramData\\chocolatey\\lib\\npm\\tools\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "learnyounode"
npm ERR! cwd C:\Dev\Personal
npm ERR! node -v v4.2.2
npm ERR! npm -v 1.4.9
npm ERR! code E404
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Dev\Personal\npm-debug.log
npm ERR! not ok code 0

for-loop verify is expecting 45 instead of 10

Really dig this!

However, there seems to be a bug.

The for-loop exercise indicates that the limit variable should equal 10.

Then when a user runs verify, it expects 45 instead of 10.

The user then has to change the limit variable o 45 to pass the validation.

If this is by design, my apologies.

Thanks!

translations

javascripting now has i18n support thanks to @martinheidegger!

@a0viedo, @NgaNguyenDuy: we could potentially merge the translations you've been working on into this module to make things simpler. You can look at the additions made in the latest commits to see how the japanese translation works. let me know what you think!

Paths containing spaces break verify

run-content.js uses a child_process exec string to run solutions. Since it is possible for attempted solution paths to contain spaces, the path part of the exec string should be surrounded with double quotes.

For example, running javascripting verify C:\Users\TestUser\nodeschool test\introduction.js causes the following error:

Error: Command failed:
module.js:340
    throw err;
          ^
Error: Cannot find module 'C:\Users\TestUser\nodeschool'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:929:3

troubleshooting.md translations

We should create troubleshooting_ko.md and troubleshooting_es.md files before doing the next npm release.

Currently I get this error when the verify command fails and I have a language selected that doesn't have a troubleshooting_xx.md file:

Error: ENOENT, no such file or directory '/Users/sethvincent/workspace/javascript-modules/nodeschool/javascripting/troubleshooting_es.md'

Failure is harsh indeed.

Original discussion here. I was reading the sentence in the nodeschool site and goes as follows:

The workshop runs their solution and checks if all requirements were satisfied. If any are wrong or missing the learner gets contextual feedback and they can try again.

And this is what it's displaying right now:
failure

Not like any contextual feedback I've ever seen...Maybe we can encourage to try again?

Error when running "javascripting"

Hello,

Upon running:

javascripting

on Ubuntu I get the following error:

/usr/bin/env: node: No such file or directory

I'm very new to Ubuntu and have never done Node.JS before, am I doing something wrong? The server is relatively new, I've installed telnet and ssh but not much else.

Console log - http://pastebin.com/n7ifVjGU

Thanks in advance,

Popey

javascripting not installing as a global variable

Hi,

I followed the suggested commands for installing but even after installing the module 'javascripting'
fails to run as a global variable. The error I receive when attempting to run it as a global variable is "/usr/bin/env: node: No such file or directory".

After receiving this error I attempted to move the module to /usr/bin/env from the directory it installed in (usr/local/lib/node_modules/javascripting). Unfortunately, I was not able to move the files because /usr/bin/env is not a directory, rather it seems to be some sort of executable java file (usr/bin is a directory).

I am a bit lost and would love some advice on either how to install the module as a working global variable or whether there is another way to run the module without installing it as a global variable.

Thanks!

Javascripting - For Loop Error

I cannot move on from this exercise...below are my code and the result I am getting. What am I doing wrong?

Thanks.

MY CODE:

var total = 0;
var limit = 10;

for (var i = 0; i < limit; i++) {
total =+ i;
};

console.log(total);

RESULT:

Solution

45

Your Attempt

9

Difference

945

syntax highlighting in terminal

hey this module rules so far!

I use the default white terminal style on macOS and it looks like this:

screen shot 2014-10-13 at 8 16 47 pm

I hooked up http://npmjs.org/ansimd but it required me sending this PR stephenmathieson/node-ansimd#1

I think it would be best to disable syntax highlighting by default, but im not sure if the cli-md module can do that

if you like ansimd more I can send a PR once the upstream one lands

Official solutions not provided after passing verification

Node 4.2.1, Windows 7:

Official solutions aren't provided after running, for example: javascripting verify program.js. Wanted to give a heads up in case this is not a known issue at this time.

Here's an example of the output:

# PASS
Your solution to ROUNDING NUMBERS passed!

Here's the official solution in case you want to compare notes:

───────────────────────────────────────────────────────────────

# THAT NUMBER IS ROUNDED

 Yep, you just rounded the number 1.5 to 2. Good job.

 In the next challenge we will turn a number into a string.

 Run javascripting in the console to choose the next challenge.

───────────────────────────────────────────────────────────────

javascripting verify for-loop.js hangs in terminal

hello,
I have for-loop.js which contains this:

var total = 0
var limit  = 10
for (var i = 0; i < limit; total += i) {
    total =+ i;
};
console.log(total);

Whenever I try to run javascripting verify for-loop.js, the terminal just hangs and provides no feedback. What did I do this time :) ?

Thx!

# O-oh, something isn't working.

can you guys tell me why i am seeing this error...
for the functions task even i copied the code from solutions but still I am seeing this error.
can u help me in fixing it

C:\Users\Desktop\node-school> javascripting verify functions.js

O-oh, something isn't working.

But don't panic!


Need help? Ask a question at: github.com/nodeschool/discussions/issues

installing

hi, i'm new but it's not installing for some reason. I have node installed but when I type in javascripting after following the instructions, I get "-bash: javascripting: command not found". Thanks for the help!

Electron App

This would be even cooler if it had an electron app to go along with it. 😎 Ps add me 👍

TypeError when running javascripting

Installed node, installed javascripting, ran javascripting, got the blue menu, selected the first lesson and:

TypeError: Object #(Transform) has no method 'destroy'

followed by a traceback..
Any ideas?

Running 32 bit node.js on Win 7

Crash on verifying

There is a critical bug.

When I try to verify something, it throw error:

module.js:339
    throw err;
    ^

Error: Cannot find module './lib/footer.js'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/usr/lib/node_modules/javascripting/lib/problem.js:42:9)
    at /usr/lib/node_modules/javascripting/lib/compare-solution.js:27:7
    at /usr/lib/node_modules/javascripting/lib/run-solution.js:9:10
    at ChildProcess.exithandler (child_process.js:194:7)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)

UPD: I've tried to check out here e1101b2. All works fine here. So, maybe something goes wrong with @martinheidegger's commits.

Change to workshopper

Hello @sethvincent I am asking even though I wonder if its futile: Do you think its hard to change the system to workshopper. The reason why I asked is: It is quite some work to translate the content into various languages. Changing to workshopper would make it easier to translate javascripting to other languages.

Be more helpful if the file to be verified has the wrong name

If the user accidentally creates a file with the wrong name, the workshop produces the generic error "O-oh, something isn't working."

It should let the user know that the file being verified doesn't have the expected name (or doesn't exist).

Scope Problem is Confusing

As someone who has no previous JavaScript knowledge, the Scope problem is quite frustrating. Even though the introduction does a good job defining scope, I was not prepared to follow the code example.

Comments need to be added next to console.log to indicate that when we pass the argument within bar back to the function, var b = 2 will be ignored. I'm sure I haven't phrased that well, but it's a starting point.

Also, what purpose does the line foo(); // 4, 2, 48 serve? I understand that foo is the function's name, and the comments next to it are the values of these variables, but this statement is just sitting there. We need context. What would including foo(); at the end of this program do when we run it?

I also don't believe the IIFE section adds any relevant information to this problem. It is distracting.

Now moving on to the challenge, I don't understand why there is )(); after every closing }. I suppose that ties back to the foo(); in the example code, but I don't understand its usage.

Contextual errors/hints on failures.

I've started adding some example ones over here. I know it's pretty crude (those regexs are pretty horrible! :p). Just wanted to gauge peoples responses before I start adding more to all the other exercises and cleaning everything up.

Eg.

$ cat a.js
var pizza = 'pizza is alright';
pizza.replace("alright", "wonderful");
console.log(pizza);
$ javascripting verify a.js
Nearly there! The replace function returns a new string, so make sure you assign the result to a variable!
-------------------
# O-oh, something isn't working.
But don't panic!
-------------------
Need help? Ask a question at: github.com/nodeschool/discussions/issues

Output for incorrect submissions

I feel providing the output from the submitted files in the terminal on failed (and maybe even on successful submissions) would be beneficial reinforcement. You can see where you might be going wrong. Perhaps at the very least provide somewhere in the Readme or elsewhere that running node filename.js in the terminal will print your output.

Test for case-insensitivity and give hints

I got reminded in nodeschool/discussions#700 that sometimes the problem occurs that people don't see the difference in their output. uppercase/lowercase etc. It might be good to check something like:

function normalise(string) {
   return string.replace(/\.|\!|\?|\s|/g, "").toLowerCase()
}

function isProbablyTypo(expectedAnswer, answer) {
   return normalise(expectedAnswer) === normalise(answer)
}

if (isProbablyTypo(expectedAnswer, answer)) {
   console.log("Looks like you did the right thing but maybe you had a typo in there. We are a little picky to make sure that you understood the question. Maybe you want to check for typos?")
}

Some text not visible in solarized dark theme

image

In solarized dark theme certain text areas invisible. Maybe it is problem of the theme but this is rather annoying and the theme is quite popular. Possible workaround is with --no-colors.

javascripting v1.9.1 always reports null/blank for solution value

Installed node and javascripting tutorial this mornig on Windows 8 machine:

$ node --version
v0.10.35

I then installed the current (v1.9.1) release of the javascripting tutorial from http://nodeschool.io/#workshopper-list using the command:

npm install -g javascripting

I created a file, introduction.js, with the contents:

console.log('hello');

I then ran the verify command, the the output was:

# O-oh, something isn't working.
# But don't panic!
-------------------
## Check your solution:
Solution
===================

Your Attempt
===================
hello

Difference
===================
hello

Checked in with the nodeschool discussion at https://gitter.im/nodeschool/discussions, and martin verified that this is a problem introduced in the v1.9.1 release. He had me revert to v1.9.0:

And now the verification is working correctly:

$ javascripting verify introduction.js
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@     YOUR SOLUTION IS CORRECT!     @@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-------------------
# YOU DID IT!

Apostrophes in instructions converted to &#39;

Hello,

First of all, thanks for putting this together. I do appreciate it!

I've noticed that apostrophes in instructions are converted to &#39;. I've tried hacking at this to find a solution, but was unsuccessful. I suspect it may even be with the cli-md module as double quotes are converted to &quot; and so on.

If I can be of any help to resolve this, don't hesitate to let me know.

Thanks!

Inconsistent spaces in the scope exercise

This may soon be obsolete if you follow up on #125, but I noticed inconsistent spaces in the scope exercise:

Use your knowledge of the variables' scope and place the following code inside one of the functions in 'scope.js'
so the output is a: 1, b: 8,c: 6

console.log("a: "+a+", b: "+b+", c: "+c);

Is there or is there not supposed to be a space before c: 6? (That is a rhetorical question: I already did the exercise. ;)

Looping Through Arrays troubles

Even with the For Loop section pulled up, I was not able to find my own solution to the Looping Through Arrays challenge. It wasn't clear to me what I should put for the variable and the condition, as well as how I should increment.

I didn't immediately pick up on the hint that I had to define the variable i in order for it to be used. I also thought something like i++ only worked on numerical values. I didn't understand how to use it on the string values of the pets array.

Once I reviewed the posted solution, I realized that an arbitrarily named counter variable is what is being incremented, which is represented here by the variable i. This value increases every time the loop repeats. As long as the numerical value of i is less than the number of positions in the pets array, every entry in the array is assigned to be the same value with an s added to the end of it.

I think we could phrase the Looping Through Arrays challenge in a way in which would have helped me come to these realizations without needing to pull up both the For Loop section and the solution. This challenge took much longer to understand than any of the other ones.

javascripting not running with io.js v1.4.1

Install and run:

$ javascripting

Select the first adventure INTRODUCTION, fails with:

node: ../deps/uv/src/unix/stream.c:1174: uv_shutdown: Assertion `(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE) && "uv_shutdown (unix) only supports uv_handle_t right now"' failed.
Aborted

Works fine with v0.12 though.

Suggestion to Lesson "NUMBER TO STRING"

migrated from nodeschool/discussions#760
/cc @closer76 @SomeoneWeird @a0viedo @martinheidegger

  1. The example of this lesson is shown as:
   var n = 256;
   n.toString();

And it might lead to confusion, since .toString() won't modify n itself and this statement doesn't make much sense. Suggested to be:

   var n = 256;
   n = n.toString();
  1. I tried the following code snippet for the chanllenge:

    var n = 128;
    n.toString();
    console.log(n);   // well, n is still a number, not a string
    

    and it passed the verification (which is wrong). I think the problem is the verification script checks the output only, and in this case, the output will always be 128 no matter n is a number or a string.

    I suggest to ask challengers to print out "the length of the string". If the challenger tries to use .length on a number, he or she will get "undefined".

/usr/bin/env: node: No such file or directory

After I do the installation:

npm install --global javascripting

Y try to run: javascripting in terminal

But terminal show me this error:

/usr/bin/env: node: No such file or directory

looping-through-arrays.js solution bug?

I'm pretty sure I've got the looping through arrays code right, but I'm getting this error (there's no way the solution is supposed to be 45 if we're trying to get the array values to be plural, right?)

$ javascripting verify looping-through-arrays.js
-------------------
# O-oh, something isn't working.

# But don't panic!

-------------------
## Check your solution:

Solution
===================

45


Your Attempt
===================

[ 'cats', 'dogs', 'rats' ]


Difference
===================

[ 'cats', 'dogs', 'rats' ]45

My code was:

File: looping-through-arrays.js                        

var pets = ['cat', 'dog', 'rat'];
for (var i = 0; i < 3; i++) {
  pets[i] = pets[i] + 's';
}
console.log(pets);

Am I crazy? Possibly crazy.

new lesson workflow doubts

I want to contribute to with the scope lesson (in english) but I have some doubts i want to solve before creating a pull request.

Since the lesson would be new there are no translations for it, so when picking another language (ex. chinese) two things happen:

  1. the scope lesson name in the main menu appears as "?zh-cn.exercise.SCOPE?"
  2. when this option (scope lesson) is selected the program crashes

Is there any way to fix this or is it normal until the translations are provided?
in that case, should I do the pull request?

v2.0.0 release: translations!

I'd like to get the translations released to npm, but it looks like there are a couple things we should settle first:

  • #84 translate troubleshooting.md to ko & es
  • #83 have an approach for lessons that are not yet translated

Is there anything else that should be included?

Using a story to teach the 'why' of JavaScript

Hi,

I helped mentor a NodeSchool a few weeks ago in Reno, NV. After the workshops, the mentors got together to compare notes and we noticed that a lot of people had the same questions and problems. One of the them was the for loop exercise that already has an issue on it. A lot of students had trouble understanding "why" they would use programming and the exercises only described the "how".

We came up with the idea of re-building the exercises but incorporating a running story to help give the "why" and also attempting to clean up some of the recurring misunderstandings that we saw.

Would you be interested in seeing this as a fork of this project? Or would it be better if I created a new project?

Thanks!

Error on Windows with Git Bash

img_1368

At the last workshop one of the attendees got an error when starting javascripting. I tried to find the issue (which was painful due to the current structure of some modules). It seems to me that in simple-terminal-menu this line returns null:

  if (!process.stdin.isTTY)
    return null

That would mean that there's something wrong with Node though. Maybe someone else has another idea.

For loops are confusing

Writing javascript for this first time last night with this tutorial, but the tutorial's description of for loops stumped me!

I had to get my dev-friends to explain how they work. 🍕

Better instruction for what to do when stuck

Hey, thanks for the time you're putting into this! I'm getting a fail message on the introduction.js at the moment. I'm fairly certain I've done everything according to instruction. So, I'm stuck there, but I'm also a bit stuck on where to go to find a solution. It's indicated, "Need help? View the README for this workshop: github.com/sethvincent/javascripting" - but the README doesn't really clarify if there's a designated forum for getting help or resource for reading up on what we might be doing wrong when we receive a failure message.

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.