7 kyu

Singleton Pattern

8,107 of 8,202hculap

Description:

In software engineering, the singleton pattern is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system.

Create an Singleton pattern, so there is one object in system.

Example:

var obj1 = new Singleton();
var obj2 = new Singleton();
obj1 === obj2; // => true
obj1.test = 1;
obj2.test; // => 1
Singleton
Object-oriented Programming
Fundamentals

Stats:

CreatedApr 17, 2014
PublishedApr 17, 2014
Warriors Trained13947
Total Skips1397
Total Code Submissions49503
Total Times Completed8202
JavaScript Completions8107
CoffeeScript Completions113
Total Stars175
% of votes with a positive feedback rating79% of 300
Total "Very Satisfied" Votes204
Total "Somewhat Satisfied" Votes68
Total "Not Satisfied" Votes28
Ad
Contributors
  • hculap Avatar
  • jhoffner Avatar
  • trashy_incel Avatar
Ad