Slice or Trim only last characters by certain integer - Javascript Number Operation

Javascript examples for Number Operation:Integer

Description

Slice or Trim only last characters by certain integer

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w  w w.ja va 2  s  .c o  m*/

var imgSrc = 'http://www.java2s.com/broken/images/something/16.png';
var srcID = imgSrc.split('/').pop().replace(/\D+/,'');
document.body.innerHTML = srcID;

    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials