Using Javascript from SpiderBasic
sworteu
 
Posts: 18
Joined: Sun Feb 07, 2016 9:49 am

How to use constant in javascript?

by sworteu Tue Feb 09, 2016 2:32 pm

I know how to use variables, pointers and functions but how to add constants to javascript?
Fred
Site Admin
 
Posts: 1013
Joined: Mon Feb 24, 2014 10:51 am

Re: How to use constant in javascript?

by Fred Tue Feb 09, 2016 2:35 pm

You mean PureBasic constants ? If yes, it's not possible, as it's resolved by the compiler before generating the JS.
sworteu
 
Posts: 18
Joined: Sun Feb 07, 2016 9:49 am

Re: How to use constant in javascript?

by sworteu Tue Feb 09, 2016 3:17 pm

Fred wrote:You mean PureBasic constants ? If yes, it's not possible, as it's resolved by the compiler before generating the JS.


I see, that's a pitty.

This is the right way then?

Code: Select all
Procedure Some()
const.s = #myconstant
!document.title= v_const
EndProcedure
Fred
Site Admin
 
Posts: 1013
Joined: Mon Feb 24, 2014 10:51 am

Re: How to use constant in javascript?

by Fred Tue Feb 09, 2016 4:33 pm

Looks OK.
Return to Javascript

Who is online

Users browsing this forum: No registered users and 2 guests