Skip to Content
ハンズオンJavaScript
book

ハンズオンJavaScript

by あんどうやすし
November 2020
Intermediate to advanced
740 pages
9h 12m
Japanese
O'Reilly Japan, Inc.
Content preview from ハンズオンJavaScript

2章データを学ぶ

プログラムは、限界まで単純化すると「データ」を「処理」するものです。つまりプログラムは何かしらのデータを入力として受け取り、何らかの処理を施して出力します。受け取るデータには数値や文章もあれば、画像や音声もあるでしょう。施される処理はもちろん受け取るデータによって異なり、たとえば数値であれば簡単な四則演算から統計処理までさまざまな数学的操作が考えられますし、画像であれば単純な色の変更から複雑な物体検出まで多種多様な操作がありえます。

これから数章に渡ってJavaScriptの文法について説明しますが、まず初めに本章でJavaScriptで利用できる基本的なデータの種類とそれぞれに対して実行できる単純な処理について学びます。

2.1 データの種類

プログラミング言語で利用できるデータには種類があり、その種類のことを(type)と呼びます。データの型が異なるとその表すものが異なるのは当然ですが、それだけではなく、そのデータに対して適用できる処理も異なります。たとえば文字列型の「"9.80665"」は文字の並びなので、その「3文字目を取り出す」ことができますが、数値型の「9.80665」は同じように見えたとしても実際には全体でひとつの数値を表しているものなので、「3文字目を取り出す」ことはできません。

> "9.80665"[2] 
"8"
> 9.80665[2] 
undefined

扱うことができるデータの種類はプログラミング言語によって異なります。たとえばJavaScriptでは数値を表す型は数値型と長整数型の2つだけですが、符号の有無や表現できる範囲などで型を分けて扱う言語も存在します。JavaScriptで利用できるデータ型は大きく分けて表2-1 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

アルゴリズムクイックリファレンス 第2版

アルゴリズムクイックリファレンス 第2版

George T. Heineman, Gary Pollice, Stanley Selkow, 黒川 利明, 黒川 洋
Python機械学習クックブック

Python機械学習クックブック

Chris Albon, 中田 秀基
オブザーバビリティ・エンジニアリング

オブザーバビリティ・エンジニアリング

Charity Majors, Liz Fong-Jones, George Miranda, 大谷 和紀, 山口 能迪
プログラミングRust 第2版

プログラミングRust 第2版

Jim Blandy, Jason Orendorff, Leonora F. S. Tindall, 中田 秀基

Publisher Resources

ISBN: 9784873119229Other