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

I will do it.

Edit: shit, I forgot to put a time limit on that promise... uhhh g-guys how about you just ignore this post and keep scrolling

Made this quick doodle animation around 3 days ago as of posting this

Just a couple hours left...

And it's getting delayed to the 2nd (maybe the 15th of June if time is short) of June

The following article is an apology and a realization

(the first two sections is the apology in a tiny nutshell)

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

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

THANK YOU @Sarnes AND @SuperrONNY8 FOR THE STICKERS

+

Mini-Announcement on Progress on Current Projects!

So I finally got Spore and umm... what in the abomination have I created???!

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

... A promise is a promise.

I'm. Quitting. Duolingo.