Hello ddy,
Thank you.
You are right. IE doesn't work the same as FF. Sorry, it's my fault. I will update them.
Thank you.
You are right. IE doesn't work the same as FF. Sorry, it's my fault. I will update them.
javascript manual
- Feb. 22, 2010, 4:33 a.m.
Ah well, in IE7 and previous it doesn't work that way anyway (IE8?) so if you want your code to work as expected for most people, you should use slice(-2). Incidentally, the documentation in this site for substr doesn't talk about negative indexes while the slice documentation does. I realize that the ecmascript final doc DOES talk about negative indexes for substr but apparently IE doesn't comply. To see what I mean, bring up IE and in the address bar type javascript:'abcdef'.substr(-2) and you'll get 'abcdef', not 'ef'. FF works as the current standard says. Sorry for the confusion.
ddy
- Feb. 22, 2010, 4:03 a.m.
No. -2 begins from the end.
'abcdefg'.substr(2) = 'cdefg'
'abcdefg'.substr(-2) = 'fg'
'abcdefg'.substr(2) = 'cdefg'
'abcdefg'.substr(-2) = 'fg'
javascript manual
- Feb. 21, 2010, 2:52 p.m.
this should use slice(-2) rather than substr(-2) since for two digit minutes or seconds it displays 3 digits (e.g. 054:011 rather than 54:11)
ddy
- Feb. 21, 2010, 12:15 p.m.
Powered by Linode.
https://ya.ru