Permalink
Browse files

Corrected `indexOf` usage (to emulate `contains`).

  • Loading branch information...
1 parent fec6122 commit 424d3d36f53afb7253ac67d2d3d85910f65fbbab @MattiSG committed Mar 12, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 index.html
View
@@ -210,7 +210,7 @@
'hello'.indexOf('e') // 1
'hello'.lastIndexOf('l') // 3
-if ('hello'.indexOf('lo')) { console.log('found'); } // everything is evaluable in JS
+if ('hello'.indexOf('lo') != -1) { console.log('found'); }
(new Array(3 + 1)).join('hello') // 'hellohellohello'
@@ -413,7 +413,9 @@
'delete': 'https://developer.mozilla.org/en/JavaScript/Reference/Operators/delete',
- 'unary plus': 'https://developer.mozilla.org/en/JavaScript/Reference/Operators/Arithmetic_Operators#.2B_(Unary_Plus)'
+ 'unary plus': 'https://developer.mozilla.org/en/JavaScript/Reference/Operators/Arithmetic_Operators#.2B_(Unary_Plus)',
+
+ '!= -1': 'http://stackoverflow.com/questions/1789945/javascript-string-contains'
}
var ruby = {

0 comments on commit 424d3d3

Please sign in to comment.