Tuesday, February 7, 2023
Learning Code
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
Learning Code
No Result
View All Result
Home JavaScript

For loop not generating sequice in nodejs – JavaScript – SitePoint Forums

learningcode_x1mckf by learningcode_x1mckf
September 9, 2022
in JavaScript
0
Time limit for notify – JavaScript – SitePoint Forums
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


You might also like

An Introduction to Lodash and Its Benefits for JavaScript Developers – MUO – MakeUseOf

Mimic Javascript actions on identical element? – JavaScript – SitePoint

How To Hire a Professional JavaScript Developer and Find the Best … – Intelligent Living

I’m attempting to insert the question in nodeJs the place the transactionCode will robotically generate. however in my case after I insert in all of the 5 insert question inserting with the identical transactionCode as ABC123 however it needs to be inserted with ABC123, ABC124, ABC125, ABC126, AB127
a fair I’m calling this generate perform within the loop then why it not working and producing one after the other and inserts.

please assist how me repair this subject and make my code right.

for (let i = 0; i < 5; i++) 
    var stmt, transactionCode;

    stmt = await con.question("SELECT `token` FROM `table1` ORDER BY `ID` DESC LIMIT 1", 
        kind: con.QueryTypes.SELECT,
    );
   // this perform will return auto quantity with +1 to with earlier quantity, suppose my earlier quantity is ABC123 then my subsequent quantity will ABC124
    if (stmt.size > 0) 
        stmt.map(async (merchandise) => 
            transactionCode = merchandise.token;
            let strings = transactionCode.exchange(/[0-9]/g, "");
            let digits = (parseInt(transactionCode.exchange(/[^0-9]/g, "")) + 1).toString();
            if (digits.size < 2) digits = ("000" + digits).substr(-3);
            transactionCode = strings + digits;
        );
     else 
        transactionCode = "ABC123";
    
    
        let stmt1;
        stmt1 = await con.question("INSERT INTO `table2` (`col1`,`col2`) VALUES(:token, :title)", 
            replacements: 
                token: transactionCode,
                title: req.physique.title
            ,
            kind: con.QueryTypes.INSERT,
            transaction: transaction,
        );



transaction.commit();
return res.json( code: 200, message: "Generated", standing: "success" );

Hello,

Why not use your debugger to step via the code? For instance the VSCODE editor implements a debugger pretty merely.

Debugging is a vital factor for Node.Js growth.



Source link

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

An Introduction to Lodash and Its Benefits for JavaScript Developers – MUO – MakeUseOf

by learningcode_x1mckf
February 6, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

An Introduction to Lodash and Its Benefits for JavaScript Developers  MUO - MakeUseOf Source link

Read more

Mimic Javascript actions on identical element? – JavaScript – SitePoint

by learningcode_x1mckf
February 6, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Mimic Javascript actions on identical element? - JavaScript  SitePoint Source link

Read more

How To Hire a Professional JavaScript Developer and Find the Best … – Intelligent Living

by learningcode_x1mckf
February 6, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

How To Hire a Professional JavaScript Developer and Find the Best ...  Clever Residing Source link

Read more

How to Use Regular Expressions in JavaScript – MUO – MakeUseOf

by learningcode_x1mckf
February 6, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

How to Use Regular Expressions in JavaScript  MUO - MakeUseOf Source link

Read more

Web Development & JavaScript Trends in 2023 – Electronicsmedia

by learningcode_x1mckf
February 6, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Web Development & JavaScript Trends in 2023  Electronicsmedia Source link

Read more
Next Post
Extent-Local Variables to Promote Immutability in Java

Extent-Local Variables to Promote Immutability in Java

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

How to format a Java table with printf example

How to format a Java table with printf example

November 9, 2022
How Java’s System.in reads input from the user

How Java’s System.in reads input from the user

October 29, 2022
Learn the Popular Programming Languages C and C++ for Just $5 a Course with This Deal

Learn the Popular Programming Languages C and C++ for Just $5 a Course with This Deal

January 26, 2023

Browse by Category

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

RECENT POSTS

  • C++ Is TIOBE's Language Of The Year – iProgrammer
  • JobRunr, the Java Scheduler Library, Released Version 6.0 – InfoQ.com
  • An Introduction to Lodash and Its Benefits for JavaScript Developers – MUO – MakeUseOf

CATEGORIES

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

© 2022 Copyright Learning Code

No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#

© 2022 Copyright Learning Code

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?