Closed frankcollins3 closed 1 year ago
<div style={{ display: typeof clock == "number" ? "" : "none", color: clock < 45 ? "#DC143C" : "silver"}} > [4:20pm]
heres the code making the below output logged from chrome tools:
console.log('timer')
console.log(timer)
console.log(typeof timer)
logs indicating typeof undefined
should be ez fix. 👍 only take 5 minutes doing this. if typeof is undefined though
with viable solution in viewport, still confused: <div style={{ display: typeof clock == "number" ? "" : "none", color: clock < 45 ? "#DC143C" : "silver"}} > code in which the typeof for which the comparison is run against is a number, and the actual number is undefined Falsy block never triggered?
[4:24pm]
👍 kind of confused why the above statements don't work but this one does.
return (
<div style={{ color: 'silver', fontWeight: 'bolder'}} className="timer">
{ typeof timer === "number" ? "Next Reminder:" : "" }
{ typeof timer === "number" ? renderTimer() : "" }
{/* <p> {typeof timer === "number" ? "yesnumber" : "nonumber" } </p> */}
</div>
);
[4:48pm]
attempting to do: 👍 color: clock < 45 ? "#DC143C" : "silver" this works
<div style={{ display: clock === NaN ? "none" : "", color: clock < 45 ? "#DC143C" : "silver"}} >
// attempting to parse for number type because when the timer runs out it becomes NaN && need not be displayed.
error:
proposed approach: 0: already tried this: <div style={{ display: typeof clock !== "number" ? "none" : "", color: clock < 45 ? "#DC143C" : "silver"}} >
1: run logs get types and work backwards from values returned by logs()