JS Illegal Character

Can't for the life of me figure this out.
const period = hours ≥ 12 ? "PM" : "AM";
const period = hours ≥ 12 ? "PM" : "AM";
I get "Uncaught SyntaxError: illegal character U+2265" Any suggestions? TIA
13 Replies
13eck
13eck16mo ago
My suggestion is to remove the illegal character and use proper syntax :p is not a valid operator in JS: you need to use the >= operator.
beforecomputers
beforecomputers16mo ago
Agreed
Andrew
AndrewOP16mo ago
Thank you. Thats what I have been reading about. Just wanted to make sure.
13eck
13eck16mo ago
👍
MarkBoots
MarkBoots16mo ago
another option (ignore, just for fun)
const period = 'AP'[~~(hours/12)]+'M'
const period = 'AP'[~~(hours/12)]+'M'
Andrew
AndrewOP16mo ago
const period = hours >= 12 ? "PM" : "AM";
const period = hours >= 12 ? "PM" : "AM";
Uncaught SyntaxError: expected expression, got '=>'
Jochem
Jochem16mo ago
It's >= not => If the snippet you pasted is accurate to what you have in your code, that error doesnt concern the code on that line.
Andrew
AndrewOP16mo ago
Ok the snippet is accurate...I will have to run through the js file and see whats going on elsewhere...Thanks!
Jochem
Jochem16mo ago
The error should contain a line and character number
Andrew
AndrewOP16mo ago
yes got that error corrected thanks! now I have another js file for the weather app with this error Uncaught SyntaxError: ambiguous indirect export: error404
Jochem
Jochem16mo ago
Without code, it's like gazing in a crystal ball. Also, generally we prefer one topic per post
Andrew
AndrewOP16mo ago
GitHub
GitHub - andrewteece/weatherio
Contribute to andrewteece/weatherio development by creating an account on GitHub.
Andrew
AndrewOP16mo ago
ok sorry I will do a new post

Did you find this page helpful?