1 year 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

10 likes and I will make this my profile picture until July 14th for both Discord and GameJolt.

With my achievement with osu!, I've decided to make a pfp real quick to replace my discord pfp.

Parent post: https://gamejolt.com/p/finally-after-over-60-tries-i-finally-got…

THANK YOU @Sarnes , @SwiftCod_3 , & @Bored_Dude FOR THE STICKER PACKS

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

FINALLY! After over 60 tries, I finally got a B (no mods) on Stronger in osu!

In the last third of the song I was shaking... so if I wasn't, could've likely gotten 90% accuracy.

Also, if I'm not wrong, first 4+ star map with a B rank or higher as of rn

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

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.

;-;

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