JSFiddle - React, Tailwind, and code Playground

by Alee

JavaScript

var Child = function () {
    var totalPoints = 100;
    addPoints = function (points) {
        totalPoints += points;
        return totalPoints;
    };
    getPoints = function () {
        return totalPoints;
    };
    return {
        points: function(x) { return totalPoints; },
        addPoints: addPoints
    };
};

$(function () {
    var george = Child();
    console.log(george.points());
    console.log(george.addPoints(50));
    console.log(george.points());
});