Sunday, October 4, 2015

Javascript prototype is easy

  1. Javascript prototype is quite fuzzy word for javascript developers in the beginning.
  2. Prototype is the property which is available for all javascript functions by default.
  3. This property helps to attain inheritance in javascript.
  4. As most of them  aware of classical inheritance concept i.e inherits the methods and properties from parent class.
  5. But, In javascript there is no class keyword to achieve inheritance.
  6. Javascript is function based object orient programming language.

Find the following simple snippet to understand prototype.

function abc() {
}

Prototype methods and property created for function abc

abc.prototype.testProperty = 'Hi, I am prototype property';
abc.prototype.testMethod = function() { 
   alert('Hi i am prototype method')
}

Creating new instances for function abc

var objx = new abc();

console.log(objx.testProperty); // will display Hi, I am prototype property

objx.testMethod();// alert Hi i am prototype method

var objy = new abc();


console.log(objy.testProperty); //will display Hi, I am prototype property

objy.testProperty = Hi, I am over-ridden prototype property

console.log(objy.testProperty); //will display Hi, I am over-ridden prototype property

Same way prototype methods can be overridden in the instance

Note: If you are still not able to understand please comment your query.

8 comments:

Nora Pittman said...

Crypto-currency as a modern form of the digital asset has received a worldwide acclaim for easy and faster financial transactions and its awareness among people have allowed them to take more interest in the field thus opening up new and advanced ways of making payments. Crypto.com Referral Code with the growing demand of this global phenomenon more,new traders and business owners are now willing to invest in this currency platform despite its fluctuating prices however it is quite difficult to choose the best one when the market is full. In the list of crypto-currencies bit-coins is one of the oldest and more popular Crypto.com Referral Code for the last few years. It is basically used for trading goods and services and has become the part of the so-called computerized block-chain system allowing anyone to use it thus increasing the craze among the public, Crypto.com Referral Code.

Common people who are willing to purchase BTC can use an online wallet system for buying them safely in exchange of cash or credit cards and in a comfortable way from the thousands of BTC foundations around the world and keep them as assets for the future. Due to its popularity, many corporate investors are now accepting them as cross-border payments and the rise is unstoppable. With the advent of the internet and mobile devices,information gathering has become quite easy as a result the BTC financial transactions are accessible and its price is set in accordance with people’s choice and preferences thus leading to a profitable investment with Crypto.com Referral Code. Recent surveys have also proved that instability is good for BTC exchange as if there is instability and political unrest in the country due to which banks suffer then investing in BTC can surely be a better option. Again bit-coin transaction fees are pretty cheaper and a more convenient technology for making contracts thus attracting the crowd. The BTC can also be converted into different fiat currencies and is used for trading of securities, for land titles, document stamping, public rewards and vice versa.

Another advanced block-chain project is Ethereumor the ETH which has served much more than just a digital form of crypto-currency Crypto.com Referral Code and its popularity in the last few decades have allowed billions of people to hold wallets for them. With the ease of the online world,the ETH have allowed the retailers and business organizations to accept them for trading purposes, therefore, can serve as the future of the financial system.

Unknown said...

Archie 420 Dispensary is a trusted Cannabis dispensary base in Los Angeles California USA. It is one of the top dispensary in this part of the country. They do deliver Marijuana in the USA and to over 25 countries in the world. Bruce banner weed for sales online You can always visit their dispensary in Los Angeles using the address on their website. Place your order and get served by the best dispensary in the planet. Have fun.

freya maya said...

Crystal online pharmacy is a trusted online drug store with a wide range of products to suit the needs of our clients. Buy Drugs online Crystal Pharmacy do strive to offer the best service and ship products world wide. All the products listed on our website are Ava in stock. Expect your order to be processed Immediately when you send us your request. We deal with varieties of drugs for our customers satisfaction. We cross barriers with our products and struggle hard to meet human satisfaction. When shopping with us, Be safe and secured and you will realize how swift we are with our services.

Rubel hossen said...

Universal Gun sales is a trusted Firearm company base in Los Angeles California USA. It is one of the top Firearms Company in this part of the country. Buy gun case online They do offer the best firearms deal in the USA and to over 25 countries in the world. You can always visit their shop in Los Angeles using the address on their website. Place your order and get served by the best Firearm Company in the planet. Have fun.

Unknown said...

Are you looking to get a good sleep, relief depression, pain relieve, sex enhancement, good trip, visit the best online pharmacy to get all your required pills, shrooms and psychedelics with or without prescriptions now.

https://stdavidpharmaceuticals.com/

Unknown said...

Are you looking to get a good sleep, relief depression, pain relieve, sex enhancement, good trip, visit the best online pharmacy to get all your required pills, shrooms and psychedelics with or without prescriptions now.

https://stdavidpharmaceuticals.com/
https://stdavidpharmaceuticals.com/product-category/psychedelics/
https://stdavidpharmaceuticals.com/product-category/pills/
https://stdavidpharmaceuticals.com/product-category/chemicals/
https://stdavidpharmaceuticals.com/product-category/ibogain/

Unknown said...

국내 최고 스포츠 토토, 바카라, 우리카지노, 바이너리 옵션 등 검증완료된 메이져 온라인게임 사이트 추천해 드립니다. 공식인증업체, 먹튀 검증 완료된 오라인 사이트만 한 곳에 모아 추천해 드립니다 - 카지노 사이트 - 바카라 사이트 - 안전 놀이터 - 사설 토토 - 카지노 솔루션.

온라인 카지노, 바카라, 스포츠 토토, 바이너리 옵션 등 온라인 게임의 최신 정보를 제공해 드립니다.

탑 카지노 게임즈에서는 이용자 분들의 안전한 이용을 약속드리며 100% 신뢰할 수 있고 엄선된 바카라, 스포츠 토토, 온라인 카지노, 바이너리 옵션 게임 사이트 만을 추천해 드립니다.

Phoebe Boake said...

ocean beach strain
sticky buns strain
snowman cookies strain
collins ave strain
obama runtz strain
london pound cake strain
lion's mane strain
cookies dispensary
berry pie strain
obama runtz