Wrox Programmer Forums
|
BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers by Nicholas C. Zakas; ISBN: 9780764579080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2011, 04:23 PM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Default prototype

Hello,

I've found extreme extensibility in javascript. one of these items is prototype.
the first example:

Code:
String.prototype.endsWith = function(str){
   return (this.substring(this.length - str.length, str.length) == str);
}

if('hello'.endsWith('lo')){
    alert('OK!');
}

var x = 'this is one sample';
if(x.endsWith('ple')){
   alert('second use');
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
Subclassing dynamic prototype pattern bcamp1973 BOOK: Professional JavaScript for Web Developers 2nd edition ISBN: 9780470227800 8 March 7th, 2010 05:25 PM
Adding prototype functions AgentSmith Javascript How-To 1 July 20th, 2003 09:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.