This repo contains implementations of the same program but in different programming styles, including imperative, object-oriented programming, and functional programming. It is intended to be a teaching tool for people starting to learn about functional programming - to get concrete examples of how fp compares to other existing styles.
The way to read this repo is to read each .js
in order - the files are numbered. The code itself has ample comments.
If you want to run these examples, you need Node.js version 5.0+.
git clone https://github.com/airportyh/word-count.git
cd word-count
npm install
To run one of the files, simply type node <name of the file>
, for example:
node 1.imperative.js