Javascript condition assign value to data variable

I am reading some data from the database which are numbers. What I need to do is to assign a name to each number ... something like: get the variable: ... thevar = '1'; If thevar = 1 then myname = 'name1'; else If thevar = 2 then myname = 'name2'; How can I do this with javascript? Sorry, I don't think I've explained it properly...what I need if the syntax on how I would do this the above with javascript. Hope it now makes more sense.

以上就是Javascript condition assign value to data variable的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准