Killersites Forums

# rbuser

Member

9

1. ## Newb question on the array.sort function

Well, thanks again, Ben. What I'm happiest about is that I wasn't missing something totally obvious, and that there must be something more complicated, as you say, occuring in the process. As you can imagine, I was the kid who incessantly asked "but why?" to everything I was told by parents, teachers, lol. It just bothers me when there's (sometimes) no full explanation of the process, but we're just expected to live with "hey, it works -- that's all you need to know!" These kinds of things are stumbling blocks for me, unfortunately, when I'm undertaking something new in life such as le
2. ## Newb question on the array.sort function

Hi Ben, Thanks for doing that. It was both helpful yet still a little mysterious when I see the sequence play out. Here's how the code runs: Initial Array: myarray[0] is =>25 myarray[1] is =>8 myarray[2] is =>7 myarray[3] is =>41 Step 1 - a: 25 b: 8 - result: 17 Step 2 - a: 25 b: 7 - result: 18 Step 3 - a: 8 b: 7 - result: 1 Step 4 - a: 25 b: 41 - result: -16 Final Array: myarray[0] is =>7 myarray[1] is =>8 myarray[2] is =>25 myarray[3] is =>41 Notice "Step 3", where all of the sudden the value of a: changes to 8 vs its value of 25
3. ## Newb question on the array.sort function

Hi Ben, That's actually where I got the code, lol. I guess I'm asking this (and don't ask me why -- it's just something that will help me visualize it): In the sort example I used, say someone asked you, Ben, to write out step by step exactly what was happening as the function did it's math and comparison thing; the steps you don't SEE happening . What would you write? I'm thinking of something along the lines of: 1. a = 28 b=8 28 minus 8 means value a is larger than 0, and hence to the right of value b in the ascending sort order. 2. a = ?? b=?? a minus b = ??
4. ## Newb question on the array.sort function

I'm trying to grasp what's going on "under the hood" of the array.sort function in Javascript. Let's use the following example: var myarray=[25, 8, 7, 41] myarray.sort(function(a,{return a - b}) //Array now becomes [7, 8, 25, 41] I know it might sound silly, but since the function takes two values -- a and b -- exactly which two values are being compared at any given time in the logic?? I understand the sorting "rules" in terms of <0, 0, and >0 re: sort order. I'm just wondering what, exactly is going on in the sort process in Javascript at each step of the function?
5. ## JS equivalent of "Echo"??

Yes, the newbiest of questions, 'tis true, but what is the JS equivalent of PHP's "Echo" command? I know about using the Alert box, but that's not what I want. I just want a simple "Hello World" on the page, not as a pop up. Now, I also know about document.write, too..BUT w3schools' page on this specifically says not to use it in "live" code because it could/would rewrite an entire page after loading. Here's their blurb: "Note: Try to avoid using document.write() in real life JavaScript code. The entire HTML page will be overwritten if document.write() is used inside a function,
6. ## IE Hacks

Instead of talking about IE "Hacks", wouldn't it be more helpful to discuss "IE Conditional Comments"? I would think that IE Conditional Comments should not be considered "hacks" whatsoever, but merely ways to insert IE browser-specific code under certain defined scenarios that might correct IE display inconsistencies. Here's someone's page about it --not meant to be the be all and end all of explanations: IE Conditional Comments
7. ## CSS Layout videos use XHTML DocType? Not what Stef recommended...

I've been through a series of videos now here on HTML/CSS and am now starting to watch the CSS Layouts series (nicely done, btw). My question has to do with DocType selection. Stef made a big deal about NOT using the XHTML doctype in his earlier videos, and gave his compelling reasons why not to. And even though they were earlier videos, it's not like they were 10 years ago. He stated words to the effect that going forward, HTML Strict should remain the DocType one should use. But now I see in the CSS Layouts videos that the DocType being used is XHTML Transitional in the DreamWeaver pres
8. ## What order to watch ALL PHP videos

Thanks for the feedback.
9. ## What order to watch ALL PHP videos

Hi, One thing I've noticed about the KS University video library is that while there is a numbering system to videos in a particular section (Beginner's PHP, etc.), there doesn't seem to be a suggested order for one to follow when finished with the Beginner's section. In other words, after I am done with Beginner's PHP, should I go to "Advanced PHP", or rather as the library page shows, "Misc PHP", followed by "PHP CRUD", etc.? This is something that's bothered me about the KS University page presentation in general. Yes, I do understand that there is value in doing things a la
×