简体   繁体   中英

how to pass decimal to CasperJS via CLI?

Here is my code:

var casper = require('casper').create({
});
var D = casper.cli.get(0);
casper.echo(D);   

casper.run();

and when i run it:

G:\GG\casperjs-1.1.3\bin>casperjs 3.js 100.00
100

G:\GG\casperjs-1.1.3\bin>

I showed 100 but not 100.00.
What's wrong with it?
How can I pass decimal to CasperJS via CLI?
Thank you

If you try in your browser console the following code:

var d = 100.00;
console.log(d);

Your browser will display : 100

But if you try this :

var d = 100.05;
console.log(d);

Your browser will display : 100.05

And if you try this :

var d = 100.00;
console.log(d.toFixed(2));

Your browser will display : 100.00

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM