7 kyu
Javascript Namespacing
2,232 of 2,302arlaneenalra
Description:
Define a class named MyClass inside a namespace MyNamespace. The class constructor should accept a single string argument. It should also have a function named sayHello that returns the string passed into the constructor.
Example:
var myObject = new MyNamespace.MyClass('Hello!');
var phrase = myObject.sayHello(); // phrase should be 'Hello!'
The interesting part is that MyClass should only be accessible via the namespace and should not define any extra global variables. Code should not redefine an existing namespace, but should also function if the namespace is not previously defined.
Object-oriented Programming
Fundamentals
Similar Kata:
Stats:
Created | Oct 2, 2013 |
Published | Oct 2, 2013 |
Warriors Trained | 5364 |
Total Skips | 1329 |
Total Code Submissions | 23017 |
Total Times Completed | 2302 |
JavaScript Completions | 2232 |
Total Stars | 74 |
% of votes with a positive feedback rating | 75% of 162 |
Total "Very Satisfied" Votes | 105 |
Total "Somewhat Satisfied" Votes | 34 |
Total "Not Satisfied" Votes | 23 |