WhatIsInAName
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 - 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 }]
Developer | Victor Hall |
Username | vhall_io |
Uploaded | September 13, 2022 |
Rating | 3 |
Size | 2,583 Kb |
Views | 20,240 |
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!
Name | Size |
Missing letters | 1,859 Kb |
DNA pairing | 1,854 Kb |
Search and Replace | 1,893 Kb |
Steamroller | 1,888 Kb |
Tribute Page | 3,131 Kb |
A Pen by Victor Hall | 2,047 Kb |
Culinary Arts Institute at MCCC | 6,079 Kb |
Roman Numerical Converter | 2,102 Kb |
Drop it | 1,699 Kb |
Arguments Optional | 1,562 Kb |
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!
Name | Username | Size |
Midterm dry run | Jds317 | 1,649 Kb |
Resizable SASS Icons | Marianarlt | 7,611 Kb |
Vue.js Starter | Andymerskin | 1,268 Kb |
HEXAGON | Aurumlux | 1,684 Kb |
Shop Talk logo made in CSS | Hugo | 19,368 Kb |
BabyStore | Pablo-Ai | 3,807 Kb |
Drag and Drop Quiz | Cgspicer | 3,837 Kb |
Sticky div | Kaslab | 2,225 Kb |
Fun animations with CSS3 | Minimalmonkey | 2,360 Kb |
Foundation 5 Menu - Accessibility | Xporter | 1,999 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!