What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-04 16:07:02
js capitalize first letter
//capitalize only the first letter of the string. function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } //capitalize all words of a string. function capitalizeWords(string) { return string.repl... Add solution -
Javascript 2021-09-04 08:59:03
capitalize first letter in each word javascript
//capitalize only the first letter of the string. function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } //capitalize all words of a string. function capitalizeWords(string) { return string.repl... Add solution -
Javascript 2021-09-04 01:45:01
react split array into chunks
const chunkSize = 10; const arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]; const groups = arr.map((e, i) => { return i % chunkSize === 0 ? arr.slice(i, i + chunkSize) : null; }).filter(e => { return e; }); console.log({arr, groups}) Add solution -
Javascript 2021-09-02 22:15:02
write a javascript function that converts the first letter of every word to uppercase
//capitalize only the first letter of the string. function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } //capitalize all words of a string. function capitalizeWords(string) { return string.repl... Add solution -
Javascript 2021-08-31 21:11:03
javascript prototype vs constructor function
function Class () {} Class.prototype.calc = function (a, b) { return a + b; } // Create 2 instances: var ins1 = new Class(), ins2 = new Class(); // Test the calc method: console.log(ins1.calc(1,1), ins2.calc(1,1)); // -> 2, 2 // Change the p... Add solution -
Javascript 2021-08-31 15:21:03
slice()
//The slice() method extracts a section of a string and returns //it as a new string, without modifying the original string. // same in array but you select elements not characters const str = 'The quick brown fox jumps over the lazy dog.'; console... Add solution