JSFiddle - React, Tailwind, and code Playground

by cettox

JavaScript

var Obj = function(){
  var self = this; //store self reference in a variable
  self.planet = "World!",    // ok, let's use this planet!
  self.text = {
       hi: "Hello ",
       pl: self.planet 
  };
  self.logTitle = function(){                               
     console.log( self.text.hi +''+ self.planet ); 
  }
};

var obj = new Obj();
console.log( obj.text.hi +''+ obj.text.pl );
obj.logTitle();