Can someone assist me?
I am looking to create a JavaScript function that follows the structure of the code example below. Unfortunately, I do not have enough programming skills to develop a functional solution from scratch.
The goal is to input a value, search through an array using that value, and return the corresponding short name (the value on the right side of the colon character).
function findShortName() {
var filenames = {
"REQUEST FOR INFO": "REQI",
"MEDIA CALL": "MC",
"ISSUES NOTE": "ISN"
};
EX1.)
var value_to_search_for = "REQUEST FOR INFO (ALPHA)";
if (filenames[value_to_search_for]) {
return filenames[value_to_search_for];
}
EX2.)
var value_to_search_for = "MEDIA CALL";
if (filenames[value_to_search_for]) {
return filenames[value_to_search_for];
}
}