About General Purpose Javascript (ECMA) Syntax? [SOLVED]

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
Joseph1916
Active Member
Posts: 36
Joined: Wed Jul 12, 2023 2:58 pm
Location: Florida

About General Purpose Javascript (ECMA) Syntax? [SOLVED]

Post by Joseph1916 » Wed Aug 16, 2023 3:16 pm

To all;

OS = Ubuntu Linux 22.04
QCAD = 3.28.1

I have begun coding for a coordinate Geometry program (COGO), and the first thing I noted was ECMA implementation of JavaScript is it dose not recognize General Purpose JavaScript Keywords, such as an assignment command such as "let", as in let x = 1.5....

The objective is to create a large 2d array of point#, x, y, z, descriptions.....

Can that observation be commented on ??

Joseph1916
Last edited by Joseph1916 on Fri Aug 18, 2023 4:33 pm, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9063
Joined: Fri Mar 30, 2007 6:07 am

Re: About General Purpose Javascript (ECMA) Syntax?

Post by andrew » Wed Aug 16, 2023 5:02 pm

You can use var instead of the scoped let which is not supported by Qt Script (Qt 5).

QJSEngine (Qt 6) has some support for let as far as I know.

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: About General Purpose Javascript (ECMA) Syntax?

Post by CVH » Wed Aug 16, 2023 6:19 pm

Joseph1916 wrote:
Wed Aug 16, 2023 3:16 pm
Can that observation be commented on ??
Joseph1916, You asked that already and it was answered.
Joseph1916 wrote:
Tue Aug 08, 2023 8:06 pm
The reserved term "var" appears in in some of my snippets
CVH wrote:
Wed Aug 09, 2023 1:26 am
Correct, var is the most common way to declare variables.
One should always declare variables.
One can use var the same way:

Code: Select all

var myValue = 1.5;
A good idea is to give your variables a meaningful name. :wink:

Joseph1916 wrote:
Wed Aug 16, 2023 3:16 pm
The objective is to create a large 2d array of point#, x, y, z, descriptions.....
Isn't x-y-z a coordinate in 3D?
As input or as output to QCAD?
There is already a script of Andrew for inputting such lists.

Regards,
CVH

Joseph1916
Active Member
Posts: 36
Joined: Wed Jul 12, 2023 2:58 pm
Location: Florida

Re: About General Purpose Javascript (ECMA) Syntax? [SOLVED]

Post by Joseph1916 » Thu Aug 17, 2023 9:07 pm

Thanks to Andrew and CVH...... var is working fine... I have closed this Topic, and will restart where I left off tomorrow. Thanks...

Joseph1916

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”