Computer
Human Sense of Smell Is Faster Than Previously Thought, New Study Suggests
Read more of this story at Slashdot.
Trees and Land Absorbed Almost No CO2 Last Year
Read more of this story at Slashdot.
CodeSOD: An Overloaded Developer
"Oh, I see what you mean, I'll just write an overloaded function which takes the different set of parameters," said the senior dev.
That got SB's attention. You see, they were writing JavaScript, which doesn't have function overloading. "Um," SB said, "you're going to do what?"
"Function overloading," the senior dev said. "It's when you write multiple versions of the same method with different signatures-"
"I know what it is," SB said. "I'm just wondering how you're going to do that in JavaScript."
"Ah," the senior dev said with all the senior dev wisdom in the world. "It's a popular misconception that function overloading isn't allowed in JavaScript. See this?"
function addMarker(lat,lng,title,desc,pic,link,linktext,cat,icontype) { addMarker(lat,lng,title,desc,pic,link,linktext,cat,icontype,false); } function addMarker(lat,lng,title,desc,pic,link,linktext,cat,icontype,external) { /* preparation code */ if (external){ /* glue code */ } else { /* other glue code */ } }This, in fact, did not overload the function. This first created a version of addMarker which called itself with the wrong number of parameters. It then replaced that definition with a new one that actually did the work. That it worked at all was a delightful coincidence- when you call a JavaScript function with too few parameters, it just defaults the remainders to null, and null is falsy.
[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.Ward Christensen, BBS Inventor and Architect of Our Online Age, Dies At Age 78
Read more of this story at Slashdot.
New Passkey Specifications Will Let Users Import and Export Them
Read more of this story at Slashdot.
Casio Made a Furry Robot Designed To Cuddle and Calm You Down
Read more of this story at Slashdot.
Google Inks Deal With Nuclear Company As Data Center Power Demand Surges
Read more of this story at Slashdot.
25% of Adults Suspect Undiagnosed ADHD
Read more of this story at Slashdot.
Apple Could Release $2,000 'Apple Vision' Headset Next Year
Read more of this story at Slashdot.
AT&T, T-Mobile Prep First RedCap 5G IoT Devices
Read more of this story at Slashdot.
Adobe Starts Roll-Out of AI Video Tools, Challenging OpenAI and Meta
Read more of this story at Slashdot.
Lots of PCs Are Poised To Fall Off the Windows 10 Update Cliff One Year From Today
Read more of this story at Slashdot.
UK Considering Making USB-C the Common Charging Standard, Following the EU
Read more of this story at Slashdot.
Chinese Scientists Report Using Quantum Computer To Hack Military-grade Encryption
Read more of this story at Slashdot.
National Public Data, the Hacked Data Broker That Lost Millions of Social Security Numbers and More, Files For Bankruptcy
Read more of this story at Slashdot.
NASA Launches Europa Clipper To Probe Jupiter's Icy Moon for Signs of Life
Read more of this story at Slashdot.
'Open Source Royalty and Mad Kings'
Read more of this story at Slashdot.
India Cenbank Chief Warns Against Financial Stability Risks From Growing Use of AI
Read more of this story at Slashdot.
Internet Archive Resumes Read-Only Service After Cyberattack
Read more of this story at Slashdot.
AI Threats 'Complete BS' Says Meta Senior Research, Who Thinks AI is Dumber Than a Cat
Read more of this story at Slashdot.