Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

nullish coalescing angular example

// check if param is null if not, assign ParamValue to variable
  start = startDateParam ?? null;
  end   = endDateParam   ?? start ?? null;
  
// you also can assign a default value
  start = startDateParam ?? moment().toDate();
  end   = endDateParam   ?? moment().add(1, 'day').toDate();
 
PREVIOUS NEXT
Tagged: #nullish #coalescing #angular
ADD COMMENT
Topic
Name
8+4 =