DEV Community

Discussion on: How to build a Router with vanilla JavaScript

Collapse
 
vijayjangid profile image
Vijay Jangid

Nicely done.

$0.02 from me take it or leave it.

constructor(){
  this.routes = [];
  return this; // I don't think this is explicitly required 
                     // (unless you want to return something else than 'this')
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kodnificent profile image
Victor Mbamara 🇳🇬

Very true Vijay, It'll only be required if i wanted to chain methods. I'll edit accordingly. Thanks for noting that.