RegExp JavaScript or Regular Expressions js

RegExp is an Object A RegExp is some object that can describe a pattern of characters. Regular expressions you can use to perform pattern-matching and “search-and-replace” functions on string. RegExp’s JavaScript syntax /pattern/modifiers; A regular expression is a sequence of characters that forms a search pattern. How to use String search() With a Regular Expression Example: You can use a regular expression to do a search for “sga” in a…

September 22, 2015

AngularJS date example

AngularJS date
July 3, 2015

Date is  filter in module You can change formats date to a string based on the requested format. The samples format string of the following elements: ‘yyyy': 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) ‘yy': 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) ‘y': 1 digit representation of year, e.g. (AD 1 => 1, AD…


Factory pattern JS

Factory Pattern
June 5, 2015

The Factory pattern js it is one more creational pattern which concerned with creating different objects. The most important difference between this pattern and the others is that you no longer need to use the constructor. Instead of the usual methods, the pattern can provide a generic interface for creation. In result, we have an opportunity to select a type of factory object by ourselves. Could you imagine an ability…


Singleton Pattern JavaScript

Singleton pattern js
May 13, 2015

Singleton design pattern in javascript Definition of Singleton: Ensure a class has only one instance and provide a global point of access to it. The Singleton pattern is more popular type of design patterns that restricts instantiation of a class to a single javascript object. Usually, the Singleton pattern is a class with a special method that creates a new instance of this class if one doesn’t exist in js….


Module Pattern JavaScript

Module pattern js
May 13, 2015

What is the Module in JS Module is an integral piece of any quality application’s architecture and can help in keeping the units of code for a your project both cleanly separated and organized. This pattern is used to mimic classes in traditional software engineering and create on public and private access to methods & variables. The module pattern was improved by the reduction of global scope variables, thus decreasing…


Constructor Pattern JavaScript

Constructor pattern js
May 12, 2015

The Constructor Pattern is a special method that use to initialize a newly created object once memory has been allocated for it (in classical OOP languages). But in JavaScript we will use object constructors We used object constructors to create some types of objects and preparing our objects for use and accepting arguments which a constructor will use to set the values of member propertie and method when the object…