why ParseInt returning value in different format

Supriya25
Tera Guru

Hi All,

SCript Inlcude :

var SleepForScoppedApp = Class.create();
SleepForScoppedApp.prototype = {
    initialize: function() {},
    sleep: function(time) {
        gs.sleep(time);
    },
    type: 'SleepForScoppedApp'
};

 

System Property's :
name : holdforfewSeconds , type: integer  value : 10000
name : refreshseconds, type:integer value:3000

widget :

var ms = input.recheck ? parseInt(gs.getProperty('refreshseconds') :  parseInt(gs.getProperty('holdforfewSeconds');
gs.addInfoMessage(ms) ;

new global.SleepForScoppedApp().sleep(ms);



 

why Info Message coming like 10000.0         ???? why .0 coming after 10000




7 REPLIES 7

Supriya25_2-1720651444482.pngSupriya25_3-1720651474146.png

 

 




If I'm not wrong , I believe I'm doing below in proper way. right ? 

 

var ms = input.recheck ? parseInt(gs.getProperty('refreshseconds') : parseInt(gs.getProperty('holdforfewSeconds');
new global.SleepForScoppedApp().sleep(ms);

 



Can I go-ahead with this ?

Community Alums
Not applicable

Hi @Supriya25 ,

 

You are almost right except that you are not closing the brackets for parseInt() properly,
Here is the updated code-

 

var ms = input.recheck ? parseInt(gs.getProperty('refreshseconds')) : parseInt(gs.getProperty('holdforfewSeconds'));
gs.addInfoMessage(ms.toString());  // Ensure it's displayed as an integer
new global.SleepForScoppedApp().sleep(ms);

 

If my response has resolved your query, please consider giving it a thumbs up ‌‌ and marking it as the correct answer‌‌!


Thanks & Regards,

Sanjay Kumar

 

Thanks for joining and sharing your inputs