This is a sample code for JavaScript web tests. I like that you can do it if you have a browser. However, it's hard to do the competition programming because I'm not used to it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//改行を消す | |
str = str.replace(/\r?\n/g,""); | |
//改行で区切り配列として得る | |
strAry = str.split("\n"); | |
//値の出力 | |
console.log("NG"); | |
//スペースでスペースで区切り配列として得る | |
var ary = line.split(" "); | |
//空の配列の作り方 | |
var ary = []; | |
//要素数を指定した配列の作り方 | |
var ary = new Array(); | |
// | |
array.push('c'); | |
//文字列を数字に変換する | |
var number = Number(str); | |
//数字を文字列に変換する | |
var str = String(number); | |
//文字列中に指定の文字があるかの確認 | |
if ( str.indexOf('hoge') != -1) { | |
//strにhogeを含む場合の処理 | |
} | |
//文字列の置換 | |
var value = "あいうえおあいうえお" ; | |
var result = value.replace( /う/g , "く" ) ; //( → あいくえおあいくえお ) | |
//文字列の切り出し | |
str.substr(開始位置 ,切り出す長さ ); |