メモ用サブブログ

子曰わく學びて時にこれを習う。

2014-01-24から1日間の記事一覧

Javascript 小数点足し算

> 1+2 === 3 true > 0.3 === 0.3 true > 01+0.2 === 0.3 false > 0.1+0.2 0.30000000000000004 Why does this happen? 0.1 +0.2 is equal to 0.30000000000000004. What you need to know is that all JavaScript numbers are floating points represented i…

JavaScript 配列内の最大、最小の値を抽出

var numbers = [5, 458 , 120 , -215 , 228 , 400 , 122205, -85411]; var maxInNumbers = Math.max.apply(Math, numbers); var minInNumbers = Math.min.apply(Math, numbers); 45 Useful JavaScript Tips, Tricks and Best Practices | Flippin' Awesome F…