Recent

Author Topic: Is this a bug or feature in Str()?  (Read 1882 times)

engkin

  • Hero Member
  • *****
  • Posts: 3112
Is this a bug or feature in Str()?
« on: May 31, 2019, 07:51:56 am »
The following project (attached) prints "undefined" in the debug console:
Code: Pascal  [Select][+][-]
  1. program strbug;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   web;
  7.  
  8. var
  9.   d: double;
  10.   s: string;
  11.  
  12. begin
  13.   d := 3.0;
  14.   str(d:2:0, s);
  15.   console.log(s);
  16. end.

Compiled using Pas2JS 1.4.6:
ftp://ftpmaster.freepascal.org/fpc/contrib/pas2js/1.4.6/

pas2js -Jc -Jirtl.js -Tbrowser c:\pathToBugProject\strbug.pas

Code: XML  [Select][+][-]
  1. <!DOCTYPE html>
  2. <HTML>
  3.   <head>
  4.     <meta charset="utf-8"/>
  5.     <Title>str bug</Title>
  6.     <script src="strbug.js" type="application/javascript"></script>
  7.   </head>
  8. <body>
  9.     <div id="pasjsconsole" style="width: 640px; height: 480px;">
  10.     </div>
  11. <script>
  12.   document.addEventListener("DOMContentLoaded", function(event) {
  13.     rtl.run();
  14.   });
  15. </script>
  16. </body>
  17. </HTML>

Bug or feature?

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Is this a bug or feature in Str()?
« Reply #1 on: May 31, 2019, 03:35:48 pm »
Nevermind, it is a browser issue.

 

TinyPortal © 2005-2018