p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 (http://p2p.wrox.com/forumdisplay.php?f=174)
-   -   prototype (http://p2p.wrox.com/showthread.php?t=85603)

irProject November 6th, 2011 04:23 PM

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');
}



All times are GMT -4. The time now is 02:46 PM.

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