Last active
May 26, 2022 08:20
-
-
Save shcyiza/33c3625c926c7f46053fbb4e896ab79a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// respond variable was given before | |
function displayContent(attrName, lang) { | |
const valid_attrs = ["title", "abstract"] | |
const valid_langs = ["en", "nl", "fr"] | |
// validate attrName and lang before accessing property | |
if (valid_attrs.includes(attrName) && valid_langs.includes(lang)) return respond.data[attrName][lang] | |
return null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment