Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Mutations

// Mutations
// Return true if the string in the first element of the array contains all
// of the letters of the string in the second element of the array.
//For example, ["hello", "Hello"], should return true because all of the letters
// in the second string are present in the first, ignoring case.

function mutation(arr) {
	let second = arr[1].toLowerCase();
	let first = arr[0].toLowerCase();
	for (let i = 0; i < second.length; i++) {
		if (first.indexOf(second[i]) < 0) return false;
	}
	return true;
}

mutation(['floor', 'FLOOR']);

// OR

function mutation(arr) {
	return arr[1]
		.toLowerCase()
		.split('')
		.every(function (letter) {
			return arr[0].toLowerCase().indexOf(letter) != -1;
		});
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: constantly send a request until a desired response is recieved expressjs 
Javascript :: export data from paginated api javascript vuetify 
Javascript :: js sol 
Javascript :: javascript check if valid url 
Javascript :: how to show conditional show on select field 
Javascript :: helperbird 
Javascript :: nvm install a particular version 
Javascript :: angular deployment 
Javascript :: how to turn a multiple dimensional object into single array 
Javascript :: selectize clickable link in item 
Javascript :: vite esbuild configuration 
Javascript :: index javascript array 
Javascript :: Uncaught TypeError: $(...).steps is not a function 
Javascript :: template.json input parameters 
Javascript :: taylors javascript test 
Javascript :: Add a mirgation in sequelize 
Javascript :: how to press a button throught the dev tools console 
Javascript :: implement dynamic import on event handler 
Javascript :: JavaScript querySelector - Group selector 
Javascript :: Component on new window 
Javascript :: form needs 2 clicks to submit react 
Javascript :: email validation in form using javascript 
Javascript :: ajax status update switch toggle 
Javascript :: Focus next input once reaching maxlength value 
Javascript :: how to change default browser in vs code json 
Javascript :: react redux reducer add objects to reducer 
Javascript :: api dfetch data in reactjs 
Javascript :: Promisify with ajax call 
Javascript :: google.translate.TranslateElement part of page 
Javascript :: iteration methods 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =