Ex. to check "pr" from "programmersheaven".
var data = "programmersheaven";
var search = "pr";
var result = (data.indexOf(search) == 0);
It looks like you're new here. If you want to get involved, click one of these buttons!