Tuesday, 2 May 2017

compare text in object javascript

i want so set data in object with 2 label positif and negatif. and i want to set word into object. i try with this code

function cok(_class, doc){  
var  vocab = {
    po: {
      wd: "good job"
    },
    ne: {
      wd: "nice job"
    }
  }  
doc = doc.split(' ')
for (var _word of doc){
    console.log(vocab[_class])
  }enter code here
}
cok('po', 'baik good');
cok('ne', 'jelek nakal');

i have set the positif and negatif label but i confused to store the value and looping the word



via RayZal

No comments:

Post a Comment