locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
13 lines (12 loc) • 521 B
JavaScript
export function strtoupper(str) {
// discuss at: https://locutus.io/php/strtoupper/
// parity verified: PHP 8.3
// original by: Kevin van Zonneveld (https://kvz.io)
// improved by: Onno Marsman (https://twitter.com/onnomarsman)
// example 1: strtoupper('Kevin van Zonneveld')
// returns 1: 'KEVIN VAN ZONNEVELD'
if (typeof str === 'undefined') {
throw new Error('strtoupper() expects exactly 1 argument, 0 given');
}
return (str + '').toUpperCase();
}