I have an object
var object= {}
I put some data in an object and then want to print it like this:
document.write(object.term);
term - a variable that varies depending on different situations. When I try to print this, it comes with undefined.
How to do it?
Update:
this is the code I'm dealing with. I think this is probably not the same as what I said above, because I do it in selenium using a browser, I just thought it would look like document.write (). Here is the code
var numCardsStr = selenium.getText("//div[@id='set-middle']/div[2]/h2");
var numCards = numCardsStr.substr(4,2);
browserMob.log(numCards);
var flash = {}
for(i=0; i<(numCards); i++){
var terms = selenium.getText("//div[@id='words-normal']/table/tbody/tr[" + (i + 2) + "]/td[1]");
var defs = selenium.getText("//div[@id='words-normal']/table/tbody/tr[" + (i + 2) + "]/td[2]");
flash[terms] = defs;
browserMob.log(flash.terms);
}
source
share