locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
14 lines (13 loc) • 541 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.startswith = startswith;
function startswith(prefix, str) {
// discuss at: https://locutus.io/powershell/startswith/
// parity verified: PowerShell 7.4
// original by: Kevin van Zonneveld (https://kvz.io)
// example 1: startswith('Hello', 'Hello World')
// returns 1: true
// example 2: startswith('World', 'Hello World')
// returns 2: false
return String(str).startsWith(String(prefix));
}