ほとんどは typeof で判定できるが、一部は instanceof で確認しないと判断できない。
太字のところはひっかかりやすいので注意。RegExpはFirefoxとIEで結果が違う。
Boolean
typeof true => boolean
Number
typeof 123 => number
String
typeof "abc" => string
Object
typeof {} => object
Array
typeof [] => object
[] instanceof Array => true
RegExp
typeof /regexp/ => (Firefox2の場合) function / (IE7の場合) Object
/regexp/ instanceof RegExp => true
/regexp/ instanceof Function => false
Function
typeof function(){} => function
(function(){}) instanceof Function => true
undefined
typeof undefined => undefined
undefined instanceof Object => false
null
typeof null => object
null instanceof Object => false
2008年3月1日土曜日
JavaScriptによる変数型の判定
tags: javascript
登録:
コメントの投稿 (Atom)
ブログ アーカイブ
-
▼
2008
(151)
-
▼
3月
(20)
- 次の中で好きなプログラム言語は?の投票結果
- 個人的なPHP用のエディタ ランキング
- CentOSに yumで FFmpegをインストール
- 特選:ちょっと変わった画像関連のJavaScript 16個
- 「はてな」で見る、IEバージョン別のスクリーンショットの比較
- Visio 2003 から PDFへ 変換する方法
- IEでも faviconを表示するためにサーバ側で必要なこと
- バッチファイルでWindowsのサービスを再起動する方法
- IEの JavaScriptで リンクの hrefを変えると表示内容が変わる問題
- PHPの DateTimeオブジェクトの簡易リファレンス
- 国内ブログサービスのユーザー数の変遷 (2007 ~ 2008)
- IE6でダウンロードするファイルのファイル名が指定できない問題の回避方法
- PDOでの PostgreSQLの booleanへの INSERT
- Windows 98 SE on VMware インストールメモ
- Google AdSenseに関するプライバシーポリシー
- 動画共有サイトOnAirの サムネイル取得API用 PHPクラス
- JavaScriptによる変数型の判定
- SimpleXMLでShift_JISを使うには
- PHPでファイルを移動するには
- PHPでゼロ埋め(ゼロ パディング)
-
▼
3月
(20)
tags
- php (176)
- javascript (82)
- apache (54)
- windows (53)
- google (47)
- mysql (41)
- linux (39)
- security (39)
- css (38)
- network (37)
- api (36)
- web (35)
- ruby (34)
- install (31)
- mobile (31)
- firefox (30)
- html (27)
- ie (27)
- config (26)
- postgres (26)
- image (25)
- library (25)
- search (25)
- mail (23)
- db (22)
- feed (22)
- rails (22)
- amazon (19)
- cakephp (19)
- map (19)
- tool (19)
- url (19)
- video (19)
- service (18)
- ec2 (17)
- encoding (17)
- error (17)
- jquery (17)
- server (17)
- flash (16)
- hatena (16)
- setting (16)
- chrome (15)
- blogger (14)
- java (14)
- android (13)
- yahoo (13)
- yui (13)
- del.icio.us (12)
- extensions (12)
- http (12)
- sql (12)
- aws (11)
- compare (11)
- framework (11)
- microsoft (10)
- centos (9)
- date (9)
- free (9)
- google-maps (9)
- php5.3 (9)
- rss (9)
- safari (9)
- yum (9)
- https (8)
- office (8)
- python (8)
- smart-phone (8)
- trouble (8)
- version-up (8)
- web-browser (8)
- adsense (7)
- calendar (7)
- cdn (7)
- jquery-ui (7)
- rakuten (7)
- twitter (7)
- android-apps (6)
- backup (6)
- command (6)
- gmail (6)
- google-app-engine (6)
- pear (6)
- reference (6)
- test (6)
- tuning (6)
- ui (6)
- validation (6)
- xmail (6)
- xml (6)
- zip (6)
- amazon-linux (5)
- atom (5)
- excel (5)
- gem (5)
- ip-adress (5)
- opera (5)
- systemdesign (5)
- titanium (5)
- array (4)
- bookmarklet (4)
- bootstrap (4)
- cache (4)
- color (4)
- cron (4)
- crypt (4)
- customize-google (4)
- feedcreator (4)
- flickr (4)
- font (4)
- form (4)
- function (4)
- gettext (4)
- google-analytics (4)
- google-code (4)
- greasemonkey (4)
- helper (4)
- html5 (4)
- iphone (4)
- jquery-mobile (4)
- laravel (4)
- mac (4)
- password (4)
- perl (4)
- regexp (4)
- rspec (4)
- sbm (4)
- sitemaps (4)
- subversion (4)
- template (4)
- tls (4)
- trac (4)
- utf-8 (4)
- version (4)
- web-service (4)
- active-record (3)
- analytics (3)
- au (3)
- cloud (3)
- date-picker (3)
- dns (3)
- docomo (3)
- domain (3)
- firewall (3)
- ftp (3)
- git (3)
- google-calendar (3)
- google-docs (3)
- hardware (3)
- hatena-bookmark (3)
- hosting (3)
- i18n (3)
- ie8 (3)
- itamae (3)
- json (3)
- log (3)
- openssl (3)
- pdo (3)
- photo (3)
- png (3)
- post (3)
- postgis (3)
- price (3)
- prototype.js (3)
- s3 (3)
- selinux (3)
- seo (3)
- shift-jis (3)
- smarty (3)
- ssh (3)
- ssl (3)
- strage (3)
- string (3)
- tab (3)
- tortoise-git (3)
- url-shortener (3)
- user-agent (3)
- windows-update (3)
- xhtml (3)
- zend-framework (3)
- about-config (2)
- active-resource (2)
- aide (2)
- android-studio (2)
- anti-virus (2)
- auth (2)
- bing (2)
- bitly (2)
- blog (2)
- books (2)
- bootstrap-cdn (2)
- bot (2)
- browser (2)
- bug (2)
- capture (2)
- cdnjs (2)
- centos7 (2)
- cert (2)
- certbot (2)
- class (2)
- convert (2)
- cookie (2)
- csv (2)
- datetime (2)
- debug (2)
- django (2)
- dojo (2)
- download (2)
- dropbox (2)
- ebs (2)
- eclipse (2)
- editor (2)
- feedly (2)
- google-reader (2)
- google-search (2)
- grids (2)
- hash (2)
- highslide (2)
- ipad (2)
- japanese (2)
- jpeg (2)
- language (2)
- lets-encrypt (2)
- link (2)
- mcrypt (2)
- memory (2)
- mod-security (2)
- moible (2)
- mouse (2)
- music (2)
- node-js (2)
- oauth (2)
- paas (2)
- pdf (2)
- permission (2)
- pocket (2)
- rds (2)
- referer (2)
- rest (2)
- rewrite (2)
- rfc (2)
- sample (2)
- scraping (2)
- session (2)
- simplexml (2)
- sjis (2)
- smtp (2)
- snoopy (2)
- softbank (2)
- tag-cloud (2)
- task (2)
- tips (2)
- todo (2)
- tomcat (2)
- travel (2)
- update (2)
- upload (2)
- v8 (2)
- v8cgi (2)
- vmware (2)
- vue-js (2)
- webBrowser (2)
- wordpress (2)
- youtube (2)
- ab (1)
- actionscript (1)
- addon (1)
- adminer (1)
- aes (1)
- affiliate (1)
- ajax (1)
- analyze (1)
- android-market (1)
- apple (1)
- aurora (1)
- avast (1)
- bake (1)
- behavior (1)
- blowfish (1)
- bookmarks (1)
- bootswatch (1)
- bread-crumb (1)
- button (1)
- c (1)
- cakphp (1)
- camel-case (1)
- casio (1)
- chalice (1)
- circle-ci (1)
- clam-av (1)
- cloudformation (1)
- cloudfrare (1)
- cloudn (1)
- cloudwatch (1)
- cman (1)
- codec (1)
- codeigniter (1)
- counter (1)
- crawler (1)
- cucumber (1)
- dao (1)
- database (1)
- datastore (1)
- delete (1)
- dena (1)
- deploy (1)
- deprecated (1)
- design (1)
- django2 (1)
- dokuwiki (1)
- dump (1)
- ecoder (1)
- emacs (1)
- encrypt (1)
- english (1)
- erd (1)
- ethna (1)
- exception (1)
- f-route (1)
- file (1)
- filter (1)
- firebug (1)
- float (1)
- flv (1)
- font-awesome (1)
- font-family (1)
- fontawesome (1)
- format (1)
- formula (1)
- fulephp (1)
- gd (1)
- gdmail (1)
- gears (1)
- geo (1)
- geo-coding (1)
- geolocation-api (1)
- get (1)
- gis (1)
- github (1)
- go-lang (1)
- golang (1)
- goo (1)
- google-apps (1)
- google-checkout (1)
- google-labs (1)
- google-libraries-api (1)
- google-play (1)
- google-plus (1)
- google-trends (1)
- gpl (1)
- gps (1)
- gradle (1)
- grep (1)
- grid.css (1)
- grids.css (1)
- group-ware (1)
- hmac (1)
- hotel (1)
- html-escape (1)
- htmlsql (1)
- http-status (1)
- httpd (1)
- iaas (1)
- ids (1)
- ie6 (1)
- iftt (1)
- igoogle (1)
- iis (1)
- import (1)
- include (1)
- index (1)
- infra (1)
- innodb (1)
- insert (1)
- integer (1)
- ios (1)
- ipad-mini (1)
- ipod (1)
- itunes (1)
- j-phone (1)
- japan (1)
- jetty (1)
- jmeter (1)
- jruby (1)
- jsdelivr (1)
- kohana (1)
- labs (1)
- lambda (1)
- lamp (1)
- layout (1)
- lift (1)
- livedoor (1)
- load-balance (1)
- locale (1)
- logo (1)
- logwatch (1)
- lsync (1)
- magic-method (1)
- maintenance (1)
- math (1)
- maven (1)
- mbstring (1)
- md5 (1)
- menu (1)
- merb (1)
- migration (1)
- mime-type (1)
- minify (1)
- mock (1)
- mod-pagespeed (1)
- mod_cache (1)
- modernizr (1)
- module (1)
- monit (1)
- mootools (1)
- myisam (1)
- myrt-mobile (1)
- mysqldump (1)
- nec (1)
- neta (1)
- nginx (1)
- normalize (1)
- null (1)
- objective-c (1)
- on2 (1)
- onload (1)
- oo (1)
- openid (1)
- or-mapper (1)
- passenger (1)
- pc (1)
- pecl (1)
- photoshop (1)
- phpexcel (1)
- phpmailer (1)
- pipes (1)
- plugin (1)
- podcast (1)
- poderosa (1)
- port (1)
- postal (1)
- postfix (1)
- powerset (1)
- print (1)
- pure (1)
- python3 (1)
- qdmail (1)
- qr-code (1)
- query-string (1)
- quota (1)
- radio (1)
- rating (1)
- rbenv (1)
- reader (1)
- realtime-search (1)
- redhat (1)
- redmine (1)
- remi (1)
- replace (1)
- replication (1)
- request (1)
- require (1)
- reserve (1)
- reset (1)
- restore (1)
- return (1)
- reverse-proxy (1)
- rgb (1)
- rijndael (1)
- rkhunter (1)
- robots.txt (1)
- rootkit (1)
- round (1)
- rpm (1)
- rpmforge (1)
- rt (1)
- saas (1)
- safri (1)
- samba (1)
- scala (1)
- schedule (1)
- screen-shot (1)
- script.aculo.us (1)
- search-wiki (1)
- seasar (1)
- serverless (1)
- sever-side (1)
- sha-2 (1)
- sha-256 (1)
- sha-512 (1)
- share (1)
- shell (1)
- shopping (1)
- simpletest (1)
- simulator (1)
- sinatra (1)
- skype (1)
- sns (1)
- sort (1)
- sqlite (1)
- struts (1)
- sum (1)
- symantec (1)
- symfony (1)
- table (1)
- tag (1)
- tiips (1)
- timezone (1)
- title (1)
- toolbar (1)
- topic-path (1)
- tripwire (1)
- twango (1)
- uninstall (1)
- unit-test (1)
- url-encode (1)
- user-script (1)
- vacuum (1)
- virtual (1)
- voderfone (1)
- web-flavor (1)
- web-fonts (1)
- webdav (1)
- widjet (1)
- willcom (1)
- windows-10 (1)
- windows-7 (1)
- word (1)
- xen (1)
- xinetd (1)
- xmlrpc (1)
- xpath (1)
- xss (1)
- yaml (1)
- yii (1)
- zend (1)
0 件のコメント:
コメントを投稿