New issue
Advanced search Search tips

Issue 819345 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Mar 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

String.prototype.padStart() returns worng String when using a char null

Reported by pmpml...@gmail.com, Mar 6 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0

Steps to reproduce the problem:
1. "str".padStart(10, null);

What is the expected behavior?
"       str"

What went wrong?
returns "nullnulstr"

Did this work before? N/A 

Chrome version:  v8: '6.1.534.50'  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 28.0 r0

using node v.8.9.4
 

Comment 1 by woxxom@gmail.com, Mar 6 2018

The observed behavior is correct according to the specification:
https://tc39.github.io/ecma262/#sec-string.prototype.padstart

  6. If fillString is *undefined*, let filler be the String value consisting solely of the code unit 0x0020 (SPACE).
  7. Else, let filler be ? ToString(fillString).

https://tc39.github.io/ecma262/#sec-undefined

  The value of undefined is *undefined*.

In your case *null* is not *undefined* so step 7 converts it into a string "null".

Comment 2 by pmpml...@gmail.com, Mar 6 2018

Ok, Thanks. Sorry, thought it would be a bug.

This can be closed now.

Comment 3 by tkent@chromium.org, Mar 7 2018

Components: -Blink Blink>JavaScript
Status: WontFix (was: Unconfirmed)

Sign in to add a comment