Question: Language: JAVA Script write a function 'keyValueDuplicates (obj) that takes an object as an argument and returns an array containing all keys that are also

Language: JAVA Script

write a function 'keyValueDuplicates (obj) that takes an object as an argument and returns an array containing all keys that are also values in that object.

Examples:

obj1 = { orange: "juice", apple: "sauce", sauce: "pan" };

console.log(keyValueDuplicates (obj1)); // ["sauce"]

obj2 = { big: "foot", foot: "ball", ball: "boy", boy: "scout"}; console.log(keyValueDuplicates(obj2)); // ["foot", "ball", "boy"]

obj3 = { pizza: "pie", apple: "pie" pumpkin: "pie");

console.log(keyValueDuplicates (obj3)); // []

*******************************************************************/ function keyValueDuplicates (obj) {

| // Your code here

}

/*****DO NOT MODIFY ANYTHING UNDER THIS LINE*********/

try {

| module.exports = keyValueDuplicates;

} catch (e) { | module.exports = null; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!