Click here to Skip to main content
15,893,487 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
GeneralRe: Announcing the open sourcing of Windows Calculator Pin
Wastedtalent6-Mar-19 21:01
professionalWastedtalent6-Mar-19 21:01 
NewsThere’s a good reason for why we ‘uh’ and ‘um’ when we talk Pin
Kent Sharkey6-Mar-19 7:30
staffKent Sharkey6-Mar-19 7:30 
NewsMicrosoft has a plan to clean up its overlapping project-management services Pin
Kent Sharkey6-Mar-19 7:00
staffKent Sharkey6-Mar-19 7:00 
GeneralRe: Microsoft has a plan to clean up its overlapping project-management services Pin
Bassam Abdul-Baki7-Mar-19 5:34
professionalBassam Abdul-Baki7-Mar-19 5:34 
GeneralRe: Microsoft has a plan to clean up its overlapping project-management services Pin
Mark_Wallace8-Mar-19 8:24
Mark_Wallace8-Mar-19 8:24 
NewsNSA's Ghidra reverse engineering framework stirs up malware researchers Pin
Kent Sharkey6-Mar-19 7:00
staffKent Sharkey6-Mar-19 7:00 
NewsOnly in Javascript... Pin
Marc Clifton6-Mar-19 6:40
mvaMarc Clifton6-Mar-19 6:40 
GeneralRe: Only in Javascript... Pin
Ryan Peden6-Mar-19 7:18
professionalRyan Peden6-Mar-19 7:18 
Ha! The double exclamation is fairly common for coercing things to booleans.

I've occasionally seen the double ~ as a slightly faster Math.floor, usually used when performance isn't actually critical at all.

I've never seen someone use them both at the same time, though. I get what the writer of that code is trying to do, but somehow I doubt that this code is used somewhere that ~~ really makes a difference over the easier to read Math.floor.

For anyone wondering what this JS does, it is basically a lazy man's version of this:
JavaScript
if (Math.floor(data.Custom[record.ID].Value) > 0) {
  field.setValue(true);
} else {
  field.setValue(false);
}

In both cases, you'll end up with false if data.Custom[record.ID].Value is a string or object, because Math.floor("LOL") and Math.floor({}) both return NaN, and NaN > 0 evaluates to false.
GeneralRe: Only in Javascript... Pin
RickZeeland6-Mar-19 8:14
mveRickZeeland6-Mar-19 8:14 
GeneralRe: Only in Javascript... Pin
Mike Hankey6-Mar-19 9:18
mveMike Hankey6-Mar-19 9:18 
GeneralRe: Only in Javascript... Pin
raddevus6-Mar-19 11:59
mvaraddevus6-Mar-19 11:59 
GeneralRe: Only in Javascript... Pin
Nelek6-Mar-19 19:22
protectorNelek6-Mar-19 19:22 
GeneralRe: Only in Javascript... Pin
raddevus7-Mar-19 1:44
mvaraddevus7-Mar-19 1:44 
NewsChromium-based Edge screenshots might as well be Chrome Pin
abmv6-Mar-19 6:20
professionalabmv6-Mar-19 6:20 
GeneralRe: Chromium-based Edge screenshots might as well be Chrome Pin
Rick York6-Mar-19 9:22
mveRick York6-Mar-19 9:22 
GeneralRe: Chromium-based Edge screenshots might as well be Chrome Pin
Rick York6-Mar-19 9:28
mveRick York6-Mar-19 9:28 
GeneralRe: Chromium-based Edge screenshots might as well be Chrome Pin
  Forogar  6-Mar-19 9:43
professional  Forogar  6-Mar-19 9:43 
NewsResearchers explore what makes robots 'persuasive' to humans Pin
Kent Sharkey5-Mar-19 11:15
staffKent Sharkey5-Mar-19 11:15 
GeneralRe: Researchers explore what makes robots 'persuasive' to humans Pin
abmv5-Mar-19 19:17
professionalabmv5-Mar-19 19:17 
NewsHackers are still sticking to the tried-and-true methods Pin
Kent Sharkey5-Mar-19 11:15
staffKent Sharkey5-Mar-19 11:15 
NewsWhy programming languages are hard Pin
Kent Sharkey5-Mar-19 11:15
staffKent Sharkey5-Mar-19 11:15 
JokeRe: Why programming languages are hard Pin
WaferFun5-Mar-19 18:56
WaferFun5-Mar-19 18:56 
GeneralRe: Why programming languages are hard Pin
Dan Neely6-Mar-19 3:14
Dan Neely6-Mar-19 3:14 
GeneralRe: Why programming languages are hard Pin
#realJSOP6-Mar-19 3:40
mve#realJSOP6-Mar-19 3:40 
GeneralRe: Why programming languages are hard Pin
W Balboos, GHB6-Mar-19 5:18
W Balboos, GHB6-Mar-19 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.