What do you want to save?
Add Code snippet
New code examples
-
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 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 -
Javascript 2021-08-31 13:38:01
javascript copy items into another array
/* Copying arrays or parts of arrays in JavaScript */ var fruit = ["apple", "banana", "fig"]; // Define initial array. console.log(fruit); // ["apple", "banana", "fig"] // Copy an entire array ... Add solution