8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jscript で ES2015~ を使う

Posted at

jscript って node.js とか入っていない PC でも使えて、簡単にダイアログ出せるで結構便利

でもモダンな書き方ができないのでアロー関数なんか使うと構文エラー……

Windows10 からは Edge で ES2015 や 2016 の JavaScript も書けるしエンジンを Chakra にすればいけるんじゃ?
と思ってやってみたら動いた

特に意味のない新し目な書き方をつかったコード

[jscript.js]

const cvalue = 5

;[{cvalue}].forEach(({cvalue: e} = {cvalue: 1}) => {
    let lvalue = 0

    for(const k of [...[1, 2]]){
        lvalue += k ** k
    }

    lvalue === e
        && Symbol.for("a") === Symbol.for("a")
        && [...new Set([1, 2, 1, 2])].length === 2
        && WScript.Echo(1)
})

動いていたら WScript.Echo(1) で 1 が表示されます

これを Chakra の CLSID をエンジンにして実行

wscript //E:{1b7cd997-e5ff-4932-a7a6-2a9e636da385} jscript.js

Image.png

これで jscript ライフが捗る!?

8
7
8

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?