re: Challenge: Write your worst program VIEW POST

FULL DISCUSSION
 
class isBoolean {
   constructor(value) {
       this.value = value
   }

   assert() {
     if(typeof value === "string") {
       this.value = false
     } else if (typeof value === "undefined") {
       this.value = false
     } else if (typeof value === "object") {
       this.value = false
     } else if (typeof value === "number") {
       this.value = false
     } else if (typeof value === "symbol") {
       this.value = false
     } else if (typeof value === "function") {
       this.value = false
     } else {
       if(this.value === true || this.value === false) {
          this.value = true
       } else {
          this.value = false
       }
     }

     return this.value
   }
}

module.exports = isBoolean
code of conduct - report abuse