Singleton objects in JavaScript
DEAR READER
Not today Justin

⁂

JVL
No title available
trying on a metaphor
Sade Olutola
will byers stan first human second
Xuebing Du
Stranger Things
Lint Roller? I Barely Know Her
wallacepolsom
occasionally subtle

Janaina Medeiros
Misplaced Lens Cap

if i look back, i am lost
2025 on Tumblr: Trends That Defined the Year
noise dept.

No title available
sheepfilms

seen from United States
seen from Malaysia

seen from Türkiye

seen from Taiwan

seen from United Kingdom
seen from United States
seen from United Kingdom
seen from United States

seen from Saudi Arabia
seen from Kazakhstan

seen from United States
seen from Germany
seen from United Kingdom

seen from United States
seen from United States

seen from Türkiye
seen from Türkiye
seen from Australia
seen from United States

seen from Malaysia
@ng-learner
Singleton objects in JavaScript
what the f**k is apply, call and bind?
use of ‘use strict’?
this & prototype functions
Objects in JavaScript
As we all know,objects are instance of a class.
2 ways to create an object in JavaScript It's important to note that there are no classes(except in ES6) in JavaScript. Functions can be used to somewhat simulate classes, but in general JavaScript is a class-less language. Everything is an object. And when it comes to inheritance, objects inherit from objects, not classes from classes as in the classical languages.
Using Functions
Using Object literals
Classes in JavaScript
Defines the object's characteristics. A class is a template definition of an object's properties and methods.
JavaScript is a prototype-based language and contains no class statement, such as is found in C++ or Java (Classes are introduced in ES6).
In JavaScript , functions are classes.
function myClass() { var privateVariable; var privateMethod = function(){ /* function definition*/ }
function anotherPrivateMethod(){ /* function definition*/ }
this.publicVariable; this.publicFunction = function(){ /* function definition*/ } }
Namespace in JavaScript
A container which lets developers bundle all functionality under a unique, application-specific name. Creating a namespace in JavaScript is simple, create one global object, and all variables, methods, and functions become properties of that object.
Use of namespaces also reduces the chance of name conflicts in an application,since each application's objects are properties of an application-defined global object.
// global namespace var MYAPP = MYAPP || {};
//creating Sub namespace MYAPP.event = {};
Naming namespace,you'll capitalize the first letter. If your app requires use of global scope, it's good practice to use a namespace like this to prevent name conflicts (just as jQuery uses $ as a namespace in order to access all the methods and properties of its API).
var myApplication = { getInfo:function(){ /* function definition */ }, models : {
}, views : { pages : {} }, collections : { } };
For get to know more about Namespace patterns click here
JavaScript is Object Oriented?
Object-oriented to the core, JavaScript features powerful, flexible capabilities
Terminologies
Namespace
Class
Object
Property
Method
Constructor
Inheritance
Encapsulation
Abstraction
Polymorphism
So what is dynamic typed?
Whether or not a language is dynamic typically refers to the type of binding the compiler does: static or late binding.
Static binding simply means that the method is bound at compile time.
Dynamic languages are the opposite. They do their work at runtime. They do little or no checking for the existence of methods at compile time but instead do it all at runtime.
What is JavaScript ?
JavaScript is an object-oriented dynamic language with types and operators, standard built-in objects, and methods.
Remember, before you can be great, you’ve got to be good. Before you can be good,you’ve got to be bad. But before you can even be bad, you’ve got to try.
Art Williams