WhatIsInAName

Developer
Size
2,583 Kb
Views
20,240

How do I make an whatisinaname?

What is a whatisinaname? How do you make a whatisinaname? This script and codes were developed by Victor Hall on 13 September 2022, Tuesday.

WhatIsInAName Previews

WhatIsInAName - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>whatIsInAName</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="font">- List -</div>
<div id="test"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

WhatIsInAName - Script Codes CSS Codes

#test{ text-align: center; font-weight: bold; font-size: 50px;
}
ul{ list-style: none; color: blue;
}
body{ background: grey;
}
.font{ text-align: center; font-weight: bold; font-size: 50px;
}

WhatIsInAName - Script Codes JS Codes

function whatIsInAName(collection, source) { // What's in a name? var arr = []; var monitor = true; //Gets keys from source and creates and array var key = Object.keys(source); var i = 0; //loops through each object in collections array for(var i = 0; i < collection.length; i++){ //loops through the key array for(var j = 0; j < key.length; j++){ //tests if keys values are equal to equal if(collection[i][key[j]] !== source[key[j]]){ monitor = false; //alert("collection: " + i + ", key: " + j + "monitor: " + monitor); } //if and monitor was never set to false meaning all values were true //and we have reached the end of the keys lists then include this //object if((monitor === true) && (j == (key.length -1))){ arr.push(collection[i]); } } //sets monitor back to true so the next object can be evaluated monitor = true; } //*************************************************************// //displays array nicely in a list :p var newKeys; //gathers keys for each object in the main array called arr for(var f = 0; f < arr.length; f++){ newKeys = Object.keys(arr[f]); } var list = document.createElement("ul"); var index; //displays array nicely :p for(var a = 0; a < arr.length; a++){ for(var b = 65; b < (65 + newKeys.length); b++){ index = String.fromCharCode(b) index = index.toLowerCase(); //tests to make sure the object has that particular key //otherwise it will display underfined in its place if(arr[a].hasOwnProperty(index)){ var elem = document.createElement("li"); elem.innerHTML = arr[a][index]; list.appendChild(elem); } } } var div = document.getElementById("test"); div.appendChild(list); // document.getElementById("test").innerHTML = arr; // Only change code above this line //return arr;
}
whatIsInAName([{ "a": 1, "b": 2 }, { "a": 1 }, { "a": 1, "b": 2, "c": 2 }], { "a": 1, "b": 2 }) ;
//should return [{ "a": 1, "b": 2 }, { "a": 1, "b": 2, "c": 2 }]
WhatIsInAName - Script Codes
WhatIsInAName - Script Codes
Home Page Home
Developer Victor Hall
Username vhall_io
Uploaded September 13, 2022
Rating 3
Size 2,583 Kb
Views 20,240
Do you need developer help for WhatIsInAName?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Victor Hall (vhall_io) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!