Let’s say you have two files:

— foo.js —

module.exports = function(n) {
return n * 111;

— main.js —

var foo = require('./foo.js');

That you can run with:

node main.js


Now, if you have browserify, you can do this:

browserify main.js >bundle.js

This will create a single bundle.js file that contains main.js and anything main.js requires, in this case foo.js

Sure you can now run the code this way:

node bundle.js

But you can also run it in a browser:

— index.html —

<script src=”bundle.js”></script>

Not only that, if you invoke browserify…

“If an idea is obviously bad, find a cheap way to try it because if it turns out it’s not bad then it’s really interesting. If you have a good idea that’s obviously good, somebody else has probably tried it before.”

Reference: https://youtu.be/z9quxZsLcfo

This may sound like an opportunity to boast, but it is not. Rather this is a story of foolishness, and how one responds when one’s back is against the wall.

I took a year off in college, got married, moved, and enrolled to new university so that I can continue working toward my degree. How fun it was to transfer credits.

When I got the classes for my first semester back, I noticed one of them required instructor approval. So I met with the instructor who told me I need a data-structure course as a prerequisite. Armed with my transcript…

In recent years, it’s been common for JavaScript (aka EcmaScript) programmers to use Source to source compilers, also known as “transpilers”, to convert a more enhanced or modern version of the language to an earlier version that can run on older browsers.

Transpilation: purpose

In the past, developers had to wait until all of the browsers they’re targeting would get the support for a particular language construct before they could use it. For instance, if you wanted to use the .map() method on an array, you’d have to make sure that every browser that loads your web page supports at least version…

npm install

you see this all the time in a build step, such as here: http://www.codecadwallader.com/2015/03/15/integrating-gulp-into-your-tfs-builds-and-web-deploy/

Most people do not check-in their node_modules folder structure to source control. No. They require that every programmer (or build agent) that does a clone of the repository to do an ‘npm install’, which then populates the node_modules folder with the correct set of dependencies.

The benefit of not tracking node_modules in source control is that you don’t have the overhead of storing a lot of node_modules in every one of your repositories. …

hopping through the decades

I first encountered JavaScript in NetScape Navigator. But being a Windows developer, I learned its details from Microsoft documentation, which was written such that VBScript and JavaScript were treated as first-class cousins. At the time, being able to write a script that executes in an HTML page was the big innovation, not the specific syntax of the language. I didn’t hate JavaScript, I just didn’t think much about it.

Skipping ahead a few years, it’s now 1998. I’m working at Borealis, a sales-force-automation start-up in Incline Village, Nevada. I’m being asked to add scripting to the product. The requirement is…

Kenneth Kasajian

(everyone should learn to code. https://hourofcode.com)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store