« first day (7 days earlier)      last day (200 days later) » 

17:26
When are semi-colons idiomatic in JS and when aren't they?
What I've seen so far is confusing.
18:26
My girlfriend wants to learn about web development
But I don't really know any of that stuff
So I was wondering if anyone has any book to recommend
@Mast: Use them as a statement terminator.
For a complete beginner
@jacwah I never really read books, unfortunately, I just dove in
@DanPantry I'm not really a teacher and I don't know the stuff either
So I thought it would be easier
Hm
web development is a very nebulous term
Do you mean front end (browser based) or back end (server) or full stack/
I assume you mean front end
18:28
I know but she doesn't really know what she wants to learn
Like "make a cool website"
and when you say web dev, do you mean design and UX or ACTUAL development
@jacwah youre fucked
So I thought - "Aha! JS + CSS + HTML"
Yes you are
It's not just that
'make a cool website' is, uh, again, nebulous. And complex
18:29
I know!
HTML + CSS + JS is definitely the way to go but you definitely want to tackle them one at a itme.
But I was thinking JS fiddle is a good tool
they're a lot more complex than they were, say, 5 years ago.
Really?
@jacwah Does she know anything about programming?
18:30
You have semantic HTML, CSS (Which I only PROPERLY just learned in the past few months actually), and then you have JavaScript which is an entire programming language on its own
@IsmaelMiguel No
Then you are going to have 2 years of excrutiating pain
@jacwah yes. HTML5 came out. Now you no longer can use div soup (or you shouldn't). CSS has been dramatically expanded with animations and transitions. JavaScript has an entirely new standard coming out later this year (hopefully)
You are, essentially, learning 2.5 languages at once to do web development.
(html being the .5)
And then you have to bear in mind all of the pre and post production tools like build tools which can be in shell, javascript, ruby...
It would be a better idea to nail down what your girlfriend actually wants to make (less nebulous than 'a cool website') and decompose that into separate parts.
then learn the bits required for each of those parts.
The goal isn't really to learn everything there is about it but to get a taste of what it's like and to get something that looks nice to feel good about
@jacwah, in which case, your girlfriend will want to learn about design stuff first.
get her sketching things on a note pad and how she wants to lay things out.
or photoshop if she's so inclined
then learn html and css (NOT JAVASCRIPT) and get her to code the website using those.
18:32
@DanPantry That's a good idea
Nettuts is a really good resource for building sites from scratch
they walk you through it and the tutorials are free
if you pay a premium fee (£25?) you ca get access to the source materials too.
You can also look at lynda.com for instructional videos but they are really only for the very beginner and don't teach you much and again, it's not free, £25/month
@DanPantry If you watch Good Mythical Morning, they have a code to get you soemthing free from there
Or used to
Thanks for your advice
no problem, I'm glad to see more people - especially women - gettin into it
Yeah, me too
18:35
that's not to be sexist but there is a serious lack of women in web dev and computer science in general
lol i just noticed my comment was stickied....
@DanPantry Rather the opposite
My ex girlfriend actually got hounded out of comp sci because she was the only woman taking the course
Basically
I guess that happens a lot
@DanPantry So not behind every function?
18:40
@Mast eh? code example?
@jacwah Not around here, enough girls in comp sci nowadays.
@Mast I know of none who still study. This makes me sad because how else am I going to find a hunnie who likes computer science and league of legends :^)
tasklist.push({
"key" : item.sourceKey
});
That's appropriate, right?
yeah you'd want a semi colon there @Mast
you generally want a semi colon at the end of every statement
Or you can omit then entirely if you really want, javascript will just treat each new line as a new statement
Yea, but what is and what isn't a statement in JS? I mean, if var can be a function...
18:44
var foo = function() {} is a function expression, which is a statement.
if (and variations like for) are all blocks
Yea, seems good. And every call of foo would be a statement as well.
function foo() {} is a function declaration, also a block
basically any time you make an assignment or invoke a function
it's a statement
any time you use control flow or define a function
its a block
statements need ;
blocks dont
Or newlines
And if they're both, just give em one.
yeah, ; or newlines ^
yes @Mast
It's very similar to C's rules
except we don't put a ; at the end of int main() {}
18:46
I do ^^
I mean in Javascript, we don't
@DanPantry But you wouldn't really create empty functions in C
int main() {} is not the same as var foo = main() {}
There's a ; behind the .listen() of my server, which is basically my main
@jacwah no it was just an example :) there's no lamdbas in C so I'm working with what I got!
Basically, after you do one thing in Javascript, use a semi colon
unless it's a function declaration or control-flow
or a new line if you don' want to use semi colons
18:48
I like semicolons.
Most people do, and a lot of snippets in editors use them, which is why I use them.
To add in all that, you can also chain statements
var a, b=5, c=function(){}; c(),b=6,a=6;
Which is awful
Yea, what's that good for...
Save bytes
Useless.
18:51
No, it's not.
And then theres objects, strings, numbers and arrays
I'm used to compiled languages, characters get dumped anyway.
I mean, yo ushould never do what @IsmaelMiguel did
keep one statement per line, ideally
But minifiers are essential parts of the web
(That's another reason to use semi-colons, although a lot of minifiers can understand newlines as terminators)
18:53
But minifiers do a lot more than removing comments and joining statements
Thats true, they mangle names
to save bytes
Then also convert if(a == b){ c(); } into a==b&&c();
they are essentially an optional version of an optimizing compiler
(Short-cut evaluation FTW!)
Or put everything in base64 and run something like eval(decode64(gibberish))
18:54
@Mast That wastes space
it has 1/3% of overhead
Not if the ENTIRE script is inside that gibberish.
You never want to use eval
pretend it doesn't exist
if you're using eval you're doing magic voodoo
I know, just saying that's how I think of minifiers.
decoding an entire js script from base64 would take some time too
the less time it takes to display your app to the user, the better
If it takes too long, use a different language ^^
18:57
you have no alternative in the browser..
and that's the only place you'd use a minifier
Obfuscators are used anywhere though.
Protecting licensing and more of that.
security throug h obfuscation doesn't protect anything lol
That's what I keep saying.
afk playing loL
Obfuscators are smarter minificators
They don't do much on Javascript
19:03
@IsmaelMiguel Already unreadable?
@jacwah No, you can get the decoded source when it is executed.

« first day (7 days earlier)      last day (200 days later) »