29.07.2016 Views

front-end-developer_1_

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Front-End-Developer - Level 1<br />

02.Arithmetic<br />

Embedded Video: https://www.youtube.com/watch?v=fDiZAeu7sIs?rel=0<br />

Now that you have the basics of HTML and CSS under your belt, we're going to start<br />

learning our first programming language: JavaScript. Remember, web browsers can only do<br />

three things: display content with HTML, style it with CSS, and change what's displayed with<br />

JavaScript. Because all browsers support JavaScript, it's the de facto programming<br />

language of the web.<br />

We're going to take a detour away from the aesthetically pleasing and obviously useful world<br />

of web pages, so that we can learn some programming fundamentals. But don't worry! We'll<br />

be back in no time.<br />

Like earlier, I'm going to assume you're using Google Chrome for these lessons. Chrome<br />

includes a nice little console that lets you type in JavaScript code. To access it, click on the<br />

☰ button, go to the Tools menu, and click JavaScript Console. As a shortcut, you can also<br />

press Cmd + Alt + J.<br />

Here at the > prompt, you can type JavaScript and see what it does. Try typing 1 + 2; and<br />

pressing Enter.<br />

Congratulations! You just ran your first JavaScript code.<br />

You should see something like:<br />

1 + 2;<br />

3<br />

JavaScript took your code - 1 + 2 - ran it, and returned the result - 3 .<br />

The semicolon at the <strong>end</strong> of the line tells JavaScript to run everything before it. You'd think<br />

JavaScript would know on its own, wouldn't you?<br />

Now try these:<br />

Arithmetic<br />

96

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!