JSFiddle - React, Tailwind, and code Playground
HTML
<p>
Решение задачи не принимает мотивируя :
<br>
should not overwrite existing objects in the namespace
Value is not what was expected <br>
should not replace the existing namespace object
Value is not what was expected</p>
JavaScript
var MyNamespace = {}
MyNamespace.MyClass = function(param) {
if(typeof param === 'string'){
this.sayHello = function (){
return param;
}
}
}
var myObject = new MyNamespace.MyClass('Hello');
var phrase = myObject.sayHello();