javascript - String as a Single value and Array as multiple value handling -


if select 1 value getting value

val : "abc"

but if select multiple value val comming in array

val : ["abc","def"].

now because of problem neighther can work on single value nor multiple. can tell me how handle this.

eg:

var myobj = {     data : "m1",     val : "abc" } 

after adding value become

var myobj = {     data : "m2",     val : abc,def }  

function handleval(val){    if ("string" === typeof val){    console.log("do sth string");    } else if (array.isarray(val)){      console.log("do sth array")    }  }    handleval("abc");  handleval([1,2])


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -