madbernard: a long angled pier (Default)
I was just reading my friend Anneke's blog from before she did Hack Reactor. In this post she says
"I’m wrapping my head around Javascript’s call() and apply() methods. These get used a lot, and it’s important to understand just how they work. More immediately, these get used in the Hack Reactor pre-course work that I’m working my way through ..."
That crystallized an opinion in me: I want my learning materials to have opinions, because opinions are context.

Eloquent Javascript presents as a textbook, ie "neutral", but since Marijn Haverbeke is a guy with strong opinions they sometimes leak through and make the book way more valuable to me. Codecademy, on the other hand, just presents one thing after another. Last year I asked Ben-the-housemate to help troubleshooting a switch statement project there, and he had to look up the syntax, despite coding JavaScript every day. He explained that switch statements are almost never used. That kind of thing is gold! I'm happy to learn about switch statements, but knowing what the actual bread and butter of a language is is far more helpful. Anneke passed me the Functional Programming in JavaScript page, where Jafar Husain says,
"[map, filter, concatAll, reduce, & zip] will probably be the most powerful, flexible, and useful functions you'll ever learn."
That's what I'm talking about! I'd love to know enough to be able to debate about what is best in JavaScript. Wrangling in forums (well moderated forums that don't allow personal attacks), or watching such wrangles, is the best way to see all sides of a thing.
madbernard: a long angled pier (Default)
I'm grimly slogging through the Javascript track of Codecademy again. Ticking off the boxes for Free Code Camp. The "address book" bit with Bill Gates etc was particularly annoying. Did they ever explain For/In loops? Every other thing Codecademy does is massively slow and information sparse, and then suddenly they expect you to know For/In?

But! Plus side, the people behind the Free Code Camp Twitter account let me know they're building their own Javascript course, so someday Codecademy will be back in its own box for people who are happy with how it works!

Also, I've been taking breaks by reading the massive "What is Code" article at Bloomberg that was going around a few weeks back. It pointed out a quirk in Javascript that I hadn't seen elsewhere, which you can recreate right now (in at least Chrome and Firefox)... F12 to get the Developer Tools open, go to the Console tab, type in 0.2 + 0.4, hit enter. Answer: 0.6000000000000001

I found this page that explains Floating Point errors in Javascript. The upshot is, the computer stores decimal fractions as binary fractions, and sometimes there's no exact match, so it uses the closest binary fraction it has. And you get around this by rounding. I wonder if this is something that people who code JS for a living do all the time?
madbernard: a long angled pier (Default)
I've been through the first few chapters of the Aquent Gymnasium Javascript Foundations course, but that's momentarily on hold due to the Grim Flash Bugs of Hacking Team... Before that, I had some fun learning how to screw around with developer tools: F12 toggles the modern update of "view source", where you can look if webpages you visit have scripts that log things to the console, look at the scripts and how they're written, interesting stuff like that.

Around the 4th I had the idea that it would be fun to make a program that would show you the layout of the stars on the American flag (the star area is called the "union", apparently) once we added Puerto Rico as a state... And for any number of states, really. My thought was to use the brute-force ability of programs, find every rectangle that contains the right number of stars (like, for 9: 1x9, 4+5, 3x3, 5+4, 9x1) and then compare their proportions to the proportions of the union, and I got all the sub bits working. However, I've gotten hung up on the math, and looping, that breaks the number of stars into possible rectangles. I need something that will return an array of every grouping that adds to the correct number of stars, where the groupings are an even number of rows of length "X" plus any number of rows of length "X-1". (The flag has, in the past, looked like an I-beam).

A friend of mine at Amazon pointed out this online thing for learning to code Javascript, Free Code Camp. The idea is that once you know just enough to be useful, you start being of use by coding actual projects for nonprofits that sign up with them; and then you have a portfolio of work to use to get a job. Sounds pretty great, though today I hit the JQuery section and it popped me over to Codecademy... I did that last year, when it was Code Year ("Learn to code in a year!"), and it's not my style. It takes minutes of cutting and pasting at their direction to be able to shake out a bit of actual information, and they rarely explain the reasons behind anything. I vastly prefer just reading everything at once and having more freedom to build a thing...

But I know much more about CSS, now, so woo!

November 2022

S M T W T F S
  12345
6789101112
1314 1516171819
20212223242526
27282930   

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 12th, 2025 12:42 am
Powered by Dreamwidth Studios