Alternations for boolean variable

Hi, everyone here!

everyone.

As Im going through the following code, I wonder if are other ways to represent a Boolean variable, set to true or false, based on whether variable “part_time_job” is assigned (can be true or false). Storing the string “have” or “don’t have” into another variable, based on the Boolean. These are conditions. And that is the snippet of the code:

                                       function person(){
   let your_name = "Jelly";
   let number_of_courses = 7;
   let program = "Fin";
   let part_time_job = true;

    let occupancy = "";
    if(part_time_job == false){
    occupancy = "have";
     }
    else{
  
     occupancy = "do not have";
       }

do you mean like using a ternary operator? or something else?

As an option yes, could be . I would like to diverse the options for this boolean variable

I don’t understand what this means.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.