Several values, provided



  • Please indicate how to fulfil this condition in one line so that it can also be fulfilled if v.colorene 1, v.color == sync, corrected by elderman == @elder_man Been a sign -, but something's not working.

    if( v.base == 0 && v.model == 0 && v.filled == 1 && v.color == 1 ) sum = 24;
    


  • var v = {
      base: 0,
      model: 0,
      filled: 1,
      color: 3
    };
    

    if (v.base === 0 &&
    v.model === 0 &&
    v.filled === 1 &&
    (v.color === 1 || v.color === 2 || v.color === 3)) {
    sum = 24;
    }

    // или, если вариантов значений много
    var colors = [1, 2, 3, 100, 500];

    if (v.base === 0 &&
    v.model === 0 &&
    v.filled === 1 &&
    colors.indexOf(v.color) !== -1) {
    sum = 24;
    }




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2