SYNCERのロゴ
アイキャッチ画像

String.prototype.length - 文字列の長さ

String.prototype.lengthは、文字列の長さを返すプロパティです。

概要

名前
length
所属
String.prototype
Writable
no
Enumerable
no
Configurable
no
仕様書
https://tc39.github.io/ecma262/#sec-properties-of-string-instances-length

デモ

String.prototype.lengthのデモです。

<!-- このコードは編集できます。 -->

<!DOCTYPE html>
<html>
<head>
	<style>
body {
	white-space: pre-wrap ;
}
	</style>
</head>
<body>
<script>
/** try it! **/
var string = "SYNCERあいうえお" ;
var a = string.length ;
/** try it! **/

var results = { a:a, } ;

for( var name in results ) {
	console.log( name, results[name] ) ;
	document.body.appendChild( new Text( name + " = " + JSON.stringify( results[name] ) + "\n" ) ) ;
}
</script>
</body>
</html>

サポート状況

ChromeFirefoxSafariEdgeIEOperaiOS SafariAndroid
9+
  • Twitterでシェア
  • Facebookでシェア
  • Google+でシェア
  • はてなブックマークでシェア
  • pocketに保存
  • LINEでシェア
更新履歴
2017年9月29日 (金)
コンテンツを公開しました。