javascript - Change object existing value (or other suggestions) -


i'm trying code small program can learn new words , output definitions using single input. make appear bot-like, want execute 2 phases :

  • 1 first user types word : if isn't found in dictionary object, saved property , program asks definition
  • 2 user enters definition saved value of property saved.

problem occurs @ phase 2, when try add property value. used variable edited on second input property gets value. new input saved value next property instead of being added current one. part of code doesn't work , can't think of solution.

function learn() {         request = input.value;         if(enterdefinition != true) { //phase 1 : type word learn                 dictionary[request] = meaning;                 infomsg.innerhtml = "what mean ?";                 input.value = "";                 enterdefinition = true;         }          else if (enterdefinition = true) { //phase 2 : type word definition             infomsg.innerhtml = "(problem @ phase)";             meaning = input.value; //doesn't change "meaning" variable phase 1             enterdefinition = false;         }      } 

here fiddle : https://jsfiddle.net/lau1989/69o3hs78/

how can rewrite line 43 make new request edit property's value ? if can't done, there other way code i'm trying ?

thanks help


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -