I have these variables
let isactive
let istradeable = true
let issellable = false
let isrevocable
let isburnableI have an if/else that basically look at these variables and checks if they are NOT null and if it's not assign it's value to a new variable. If it is NULL set variable to true
if (isactive == null) {
isactive = true
} else {
this.isactive = isactive
}
if (istradeable == null) {
istradeable = true
} else {
this.istradeable = istradeable
}
if (issellable == null) {
issellable = true
} else {
this.issellable = issellable
}
if (isrevocable == null) {
isrevocable = true
} else {
this.isrevocable = isrevocable
}
if (isburnable == null) {
isburnable = true
} else {
this.isburnable = isburnable
}
This works but I'm looking for a simple function or maybe a better if/else statement that does the same thing. Thanks guys!
Aucun commentaire:
Enregistrer un commentaire