JSFiddle - React, Tailwind, and code Playground

by Sunny SM

HTML

<div id="result" onlick="ssss();">click</div>

JavaScript

function Plant() {
	this.country = "Mexico";
	this.isOrganic = true;
    var name;
    var color;
}
Plant.prototype.showNameAndColor =  function(name="Sunny Attwal", color="red") {
    this.name = name;
    this.color = color;
    console.log("I am a " + this.name + " and my color is " + this.color);
    return "My Name is : "+this.name+" And favorite color is " + this.color;
}
Plant.prototype.ddd = function(){
    obj = new Plant();
    if(obj.isOrganic){
        document.getElementById('result').innerHTML = obj.showNameAndColor();
    }else{
        document.getElementById('result').innerHTML = "Gate not true";
    }
}
Plant.prototype.ddd();

var demoInit = {
	msg: function(){
        alert("hello : ");
    }
};

demoInit.msg();