Category "prototype"

Parse JSON String into a Particular Object Prototype in JavaScript

I know how to parse a JSON String and turn it into a JavaScript Object. You can use JSON.parse() in modern browsers (and IE9+). That's great, but how can I t

Javascript prototype method "Cannot set property"

I'm always getting Cannot set property 'saySomething' of undefined but why? Am I making a mistake somewhere? var Person = new Object(); Person.prototype.saySo

React: Where To Extend Object Prototype

I created a pure React application using create-react-app. I would like to extend the String class and use it in one or more components. For example: String.pr

TypeError: app.get is not a function

I'm trying to use express in a prototype function ioServer() { } module.exports = ioServer; ioServer.prototype.start = function() { var app = requ

Creating a simple inventory system in JavaScript

I'm trying to make a simple text adventure/farming simulator, but I'm new to JavaScript and I'm stuck trying to plan out how my inventory system will work. The

__proto__ VS. prototype in JavaScript

This figure again shows that every object has a prototype. Constructor function Foo also has its own __proto__ which is Function.prototype, and which in turn a

How to properly set prototype?

I'm practicing an exercise in a book called Object-Oriented JavaScript. The exercise in chapter 5 contains the following 4 questions: Create an object call