JS: Using indexOf() without -1

var text = 'text'; ~text.indexOf('asd'); //sometext contains asd - false ~someText.indexOf('ext'); //sometext contains ext - true
Bitwise operators perform their operations on such binary representations, but they return standard JavaScript numerical values.

From: https://github.com/loverajoel/jstips

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.