How do I get this function to put the value for num as the call to phrase. ? I specified 1 as the input value, so why doesn't it read as phrase.1[0] ?
var phrase = {
1: "Breaking News! The world in crisis!"
};
function writeText(num){
var dialogue= phrase.num[0];
dialogue= dialogue+ phrase.num[1];
document.getElementById("dbox").innerHTML = dialogue;
};
writeText(1);
or even this?
var phrase = {
first: "Breaking News! The world in crisis!"
};
function writeText(whichPhrase){
document.getElementById("dbox").innerHTML = phrase.whichPhrase;
};
writeText(first);