JSFiddle - React, Tailwind, and code Playground
by kornim
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
//Javascript Inside 5.4.2.1
// e.g. 5-9
function HelloFunc(func) {
this.greeting = "hello";
}
// user definition function
var userFunc = function(greeting) {
console.log(greeting);
}
HelloFunc.prototype.call = function(func) {
func ? func(this.greeting) : this.func(this.greeting);
}
var objHello = new HelloFunc();
objHello.func = userFunc;
objHello.call();
// continue to e.g 5-10
function saySomething(obj, methodName, name) {
return (function(greeting) {
return obj[methodName](greeting, name);
});
}
function newObj(obj, name) {
obj.func = saySomething(this, "who", name);
return obj;
}
newObj.prototype.who = function(greeting, name) {
console.log(greeting + " " + (name || "everyone") );
}
var obj1 = new newObj(objHello, "zzoon");
obj1.call();