javascript

How to Write to a file in JavaScript

less than 1 minute read

Writing a file in Javascript is as easy as using the built-in method fs.writeFile, and as such matches the read file method quite well

How to Solve Euler 1 in JavaScript

less than 1 minute read

The Euler 1 problem is fairly simple to solve. Most people intuitively know how to do it. Here is how I would do it in JavaScript.

How to Read a file in JavaScript

less than 1 minute read

Reading a file in Javascript (again, nodejs) is as easy as using the built-in method fs.readFile (however it needs to be required first).

How to Parse Json in JavaScript

less than 1 minute read

As already stated in the post about how to write json in javascript, JSON is an integral part of the JavaScript language.

How to Read from stdin in JavaScript

less than 1 minute read

In javascript (nodejs anyway) stdin can be read as a stream of bytes. Therefore you need to tell node which encoding it is (utf-8 in our instance). We do the...

How to Write Json in JavaScript

less than 1 minute read

Since json is short for JavaScript Object Notation - it does not come as a surprise that is a natural part of the javascript language. The JSON module has tw...

How to Read Program Arguments in JavaScript

less than 1 minute read

In JavaScript (nodejs) you can access the program arguments in the array process.argv. Like in C it includes the program name but unlike e.g. PHP and Ruby it...