Skip to content

Pasting multi-line functions repeats their lines pointlessly #67364

Open

Description

@EhudKirsh

Version

v26.13.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

No response

What steps will reproduce the bug?

  1. Open Node.
  2. Paste:
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
	if(!Number.isInteger(I)||I<0)return'Please enter a positive integer or zero!'
	if(I===0||I===1)return I
	let a=0,b=1,c;--I;do{c=a+b;a=b;b=c}while(--I!==0)// # iterations = I-1
	return c
}// e.g. Fib(7) //➜ 13 , Fib(8) //➜ 21 , Fib(9) //➜ 34

You'll see that it looks like this:

node
Welcome to Node.js v26.13.0.
Type ".help" for more information.
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
| if(!Number.isInteger(I)||I<0)return'Please enter a positive integer
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
| if(!Number.isInteger(I)||I<0)return'Please enter a positive integer
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
| if(!Number.isInteger(I)||I<0)return'Please enter a positive integer
or zero!'
| if(I===0||I===1)return I
| let a=0,b=1,c;--I;do{c=a+b;a=b;b=c}while(--I!==0)// # iterations = I-1
| return c
| }// e.g. Fib(7) //➜ 13 , Fib(8) //➜ 21 , Fib(9) //➜ 34
[Function: Fib]

How often does it reproduce? Is there a required condition?

It happens every time.

What is the expected behavior? Why is that the expected behavior?

I expect it to work the way that it did in past versions of Node and also as the DevTools console works. Not repeat the same line like 5 times.

What do you see instead?

Lines being repeated, 3 times, 5 times, etc.

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions