JavaScript优雅写法及操作( 五 )


  • if else

/** * 按钮点击事件 * @param {number status 活动状态:1开票中 2开票失败 3 开票成功 4 商品售罄 5 有库存未开团 * @param {string identity 身份标识:guest客态 master主态 */const onButtonClick = (status identity) => {  if (identity == 'guest') {    if (status == 1) {      //函数处理     else if (status == 2) {      //函数处理     else if (status == 3) {      //函数处理     else if (status == 4) {      //函数处理     else if (status == 5) {      //函数处理     else {      //函数处理       else if (identity == 'master') {    if (status == 1) {      //函数处理     else if (status == 2) {      //函数处理     else if (status == 3) {      //函数处理     else if (status == 4) {      //函数处理     else if (status == 5) {      //函数处理     else {      //函数处理      

推荐阅读