Here you can find the source of capitalize()
/* Write your program/code/algorithm here. * If you're really stuck as to what exactly to define, go to the * "Description" and click on the pseudo-link to reveal the answer *//*from ww w . j ava2 s. c o m*/ String.prototype.capitalize = function () { var fl = this.charCodeAt(0); if (fl > 96 && fl < 123) fl -= 32 String.fromCharCode(fl) + this.slice(1); }
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }; Array.prototype.equalTo = function (array) { if (!array) return false; if (this.length != array.length) return false; for (var i = 0, l=this.length; i < l; i++) { ...
String.prototype.capitalize = function() { if (this.length == 1) return this.toUpperCase(); return this.substr(0, 1).toUpperCase() + this.substr(1); };
var message = ''; var student; String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); function print(message) { var outputDiv = document.getElementById('output'); outputDiv.innerHTML = message; function printAll(students) { for (var i = 0; i < students.length; i += 1) { student = students[i]; compileMessage(student); print(message); function printOne(student) { compileMessage(student); print(message); function compileMessage(input) { message += "<ul>"; for ( var key in student ) { message += "<li>" + key.capitalize() + ": " + student[key] + "</li>"; message += "</ul>"; function search(students) { response = prompt("Please enter your student query: "); for (var i = 0; i < students.length; i += 1) { student = students[i]; if ( student.name.toLowerCase() === response.toLowerCase() ) { printOne(student); break; printAll(students);
String.prototype.capitalize = function() { if(this.length === 0) { return ''; } else { return this.substr(0, 1).toUpperCase() + this.substr(1); };
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); function titleCase(title, minorWords) { var titleAr = title.toLowerCase().split(' '), minorWordsAr = minorWords ? minorWords.toLowerCase().split(' ') : []; return titleAr.map(function(e, i){return minorWordsAr.indexOf(e) === -1 || i === 0 ? e.capitalize() : e }) .join(' ');
String.prototype.capitalize = function(){ return this.charAt(0).toUpperCase() + this.slice(1);
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.substring(1);
String.prototype.capitalize = function() { return this.replace(/_/, ' ').replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); };
String.prototype.capitalize = function() return this.charAt(0).toUpperCase() + this.slice(1);