A method, Expected to return a value at the end of function created by yourself

in nuxt"s project, ESlint is referenced and a method is written

const f = function (val, sval) {
  if (val === "A" || val === "B") {
    return "";
  }
  if (val === "C") {
    return "";
  }
  if (val === "D" && sval < 5) {
    return "";
  }
  if (val === "D") {
    return "";
  }
  if (val === "E") {
    return "";
  }
  if (val === "F") {
    return "";
  }
  if (val === "G") {
    return "";
  }
  if (val === "I") {
    return "";
  }
  if (val === "J") {
    return "";
  }
  if (val === "K") {
    return "";
  }}

prompt error Expected to return a value at the end of function how to change

Mar.30,2021

const f = function(val, sval) {
  let str = '';
  if (val === 'A' || val === 'B') {
    str = '';
  }
  if (val === 'C') {
    str = '';
  }
  if (val === 'D' && sval < 5) {
    str = '';
  }
  if (val === 'D') {
    str = '';
  }
  if (val === 'E') {
    str = '';
  }
  if (val === 'F') {
    str = '';
  }
  if (val === 'G') {
    str = '';
  }
  if (val === 'I') {
    str = '';
  }
  if (val === 'J') {
    str = '';
  }
  if (val === 'K') {
    str = '';
  }
  return str;
};

you can't return if val is not equal to any of the letters listed above? The easiest way to change this is to add a sentence
return''before the last curly braces;
also suggests using objects to correspond to such multiple situations.


you need to have a default value of return at the end of the function with the addition of''

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e51040-450f3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e51040-450f3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?