mardi 9 février 2021

Ternary Operator with two conditionals

I have to learn ternary operator but I can ask a question, how to mount console.log (array) in ternary operator since it does not compile.

   const string3 = (value3, separator) => {
    if (typeof value3 === "string" && typeof value3! = "") {
      constant array = value3.split (separator)
      console.log (array)}
    else {console.log ("error")}
   }
  string3 ('hello how are you', '');

Aucun commentaire:

Enregistrer un commentaire