2 years ago

I need some serious help with JavaScript.

Out of all the stupid bugs I've encountered, this is by far the worst.


The following code should remove any \n and replace them with an empty space and then split the string into an array:


letarray = code.value.replace("\n", " ").split(" ");


code is a html textarea element:


JS:

constcode = document.querySelector("#code");

HTML:

<textarea id="code" cols="60" rows="30">text = simple\ntext = line\ntext = program</textarea>


code.value is set to:


'text = simple\ntext = line\ntext = program'


The following is what it returns:


['text', '=', 'simple', 'text', '=', 'line\ntext', '=', 'program']


What it should return:


['text', '=', 'simple', 'text', '=', 'line', 'text', '=', 'program']


Please help - I'm starting to go insane because of this stupid little bug.



0 comments

Loading...

Next up

Well... that was... fast to say the least. Only a few weeks ago I was so happy to get a B rank on a 4 star map... now I'm getting S and A ranks on them.

P.S. osu! is like a remedy for me... makes me relaxed.

Alright. Enough is enough. I'm starting over again.

Another 21 days since my last post... the accidental timing could not be anymore perfect

Anyhow, thankie for the yummy stickers packs @SuperrONNY8 and @Sarnes ... I shall nom on them at midnight

Welcome to 'Mytherland' - a brand new interactive community website which will open very soon: https://myther.land

I NOW TAKE ART COMMISSIONS For now, all of them are free

Later this year I will make a new table that looks better and with prices

Slots (1/5)

(Please read the article for example work and more info)

Stickit' Truddy, web-project introduction

A website where you can Collect and Swap stickers with friends and fill up your collector's albums!

Join dev journey at gamejolt.com/c/stickit-kt5adm

#webdev #art

BIG THANKS TO @SuperrONNY8 and @Sarnes FOR THE YUMMY STICKER PACKS

Just a midnight doodle that I decided to make last week What for... next image. Hate how the lighting turned out on the shirt - love how the lighting turned out on the thigh highs and shorts. Still learning anatomy.

Version 1.1 for Icey Fishery is out

Another Father's Day update, which was made an released on Father's Day (however only to play-tester).

The update primary focus is on quality of life features

(Read the article for more detail)