How would I write the equivalent of C#\'s String.StartsWith in JavaScript?
var haystack = \'hello world\'; var needle = \'he\'; haystack.startsWith(needle)
var str = 'hol'; var data = 'hola mundo'; if (data.length >= str.length && data.substring(0, str.length) == str) return true; else return false;