How can I cut 1st char from string in jquery?

Does anyone know how I can cut 1st char from string in jquery?

Example: If I have a line:

var test = '3265'; 

How can I cut only the 1st char, so that the output will be "3" instead?

+4
source share
3 answers

Why jQuery ?? Just use plain old javascript:

 var first = test.substring(0, 1) 
+13
source

No need jQuery, direct javascript:

 var test = '3265' var first = test.slice(0,1); 

Some thoughts on the differences between .substring (),. Substr () and .slice (): http://rapd.wordpress.com/2007/07/12/javascript-substr-vs-substring/

also: What is the difference between String.slice and String.substring?

+3
source
 Array.prototype.shift.apply(test); 
0
source

All Articles