freeCodeCamp Tokyo meetup 19

Preview:

Citation preview

freeCodeCamp Tokyo#19 2016/08/31

@ Fork Inc.

Welcome to freeCodeCamp Tokyo meetup!

Who am I?Tanoue Kenta

Web Programmer

Ruby on Rails React

“Less is more”

What is freeCodeCamp?

Today's schedule

19:15~ Opening 19:25~ Pair programming 20:00~ Presentation 20:15~ Drinking party 🍺 (fee: 500 yen)

Pair programming

Design quality Learning

Two programmers work together at one workstation. One, the driver, writes code while the other, the navigator, reviews each line of code as it is typed in.

https://en.wikipedia.org/wiki/Pair_programming

Better code (in my opinion)Readability

Maintainability

var i = 5 What does “i” variable means?

function calMaxAndExcludeOddNumbersInArr(arr)Too many roles!

Modern Javascript (ES2015)

Better code part2

https://github.com/metagrover/ES6-for-humans https://babeljs.io/docs/learn-es2015/

Arrowsvar plus = (x, y) => { return x + y; };

Classesclass Human { constructor(name) { this.name = name; } }

Array Spreadfunction f(x, ...y) { return x * y.length; } f(3, "hello", true) == 6

• Array Map, Filter, Reduce (Functional Programming)

Better code part3

Map Filter Reduce

Array Map, Filter and Reduce in JS | Aten Design Group http://atendesigngroup.com/blog/array-map-filter-and-reduce-js

Strange behavior in Javascript numbers

var x = 9999999999999999;

x will be 10000000000000000

Strange behavior in Javascript numbers

var x = 0.2 + 0.1;

x will be 0.30000000000000004

Why?JavaScript Numbers are always 64-bit Floating Point

https://en.wikipedia.org/wiki/IEEE_754-1985

Solutions

• var x = (0.2 * 10 + 0.1 * 10) / 10;

• use math.js library http://mathjs.org/index.html

Javascript data types• Six data types that are primitives:

• Boolean

• Null

• Undefined

• Number

• String

• Symbol (new in ECMAScript 6)

• and Object

What is type of Date?

typeof( Date.now() );

Numbers(Unix Timestamp)

ex) 1472635026140

Today’s challengeExact Change

https://www.freecodecamp.com/challenges/exact-change ONE HUNDRED: 100.0$

TWENTY: 20.0$ TEN: 10.0$ FIVE: 5.0$ ONE: 1.0$

QUARTER: 0.25$ DIME: 0.1$

NICKEL: 0.05$ PENNY: 0.01$

Have a nice code!

sample code

https://gist.github.com/regonn/1ffb5a71e61d569bedd98f7ac58fcef3