What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-02 22:20:17
randome words api
// GetRandom Words from API and push to Array async function getRandomWord() { const res = await fetch('https://random-words-api.vercel.app/word'); const data = await res.json(); return data[Object.keys(data)[0]].word.toLowerCase(); } getRandomW... Add solution -
Javascript 2022-02-02 21:30:20
js check string for isogram
// Check if a string is an isogram function isIsogram(str){ return !str.match(/([a-z]).*\1/i); //or: return new Set(str.toLowerCase()).size === str.length; } console.log(isIsogram("Dermatoglyphics"));//, true console.log(isIsogram("iso... Add solution -
Javascript 2022-02-01 12:06:57
8.3.1. Common Array Methods // sort Examples (.sort)
//The general syntax for this method is: arrayName.sort() /*This method arranges the elements of an array into increasing order. For strings, this means alphabetical order. HOWEVER, the results are not always what we expect.*/ let letters = ['f', 'c',... Add solution -
Javascript 2022-01-31 09:35:55
regex ranges
/* character ranges */ regex = /[a-z]/; // matches all lowercase letters regex = /[A-Z]/; // matches all uppercase letters regex = /[e-l]/; // matches lowercase letters e to l (inclusive) regex = /[F-P]/; // matches all uppercase letters F to P (inclusive... Add solution -
Javascript 2022-01-30 21:31:17
how to make a string in javascript
var abc = "abcdefghijklmnopqrstuvwxyz"; var esc = 'I don\'t \n know'; // \n new line var len = abc.length; // string length abc.indexOf("lmno"); // find substring, -1 if doesn't contain abc.lastIndexOf("lmn... Add solution -
Java 2022-01-30 19:21:59
count vowels in a string java
// There are many ways to do it the one i came up with is this: int count = 0; String sentence = "My name is DEATHVADER, Hello World!!! XD"; char[] vowels = {'a', 'e', 'i', 'o', 'u'}; for (char vowel : vowels) for (char letter : sentence.to... Add solution