Annoying arrays

@kevinSmith Honestly, that made absolutely no sense, like you are going to get incorrect data because you cant join a already joined string. If you were to take out the ‘this is not a function’ in this specific instance of joining a string and just skips over it, i seriously can’t think of anything that would suddenly happen to cause mass error. You just gave a not expert coder one sentence summaries of your error.

What? Like what? Using complicated ideas to confuse a new coder to prove a point is pretty low. I finished the intermediate algorithm scripting and moving onto the projects. Like asking me if i’m joking if i’m not educated in data bases and being rude about it is pretty low. I see it as trying to join a already joined string, not the potential for databases to be compromised. I’m only a newbie 14 year old programmer and i use the fake name ‘john’ on every website i go on, don’t take it like its set in stone.

Most kids at my age are playing video games, being rude, or getting into gang rap. Can i get the A for effort here?

We are talking about:

equation = equation.join("")
equation = equation.join("") 

Out of context. The original question to that was if i could declare multiple variables on one line in a conditional ternary to save space. Yes i did show some examples of too much code on one line like the pig Latin, but I also proposed a format that could still keep it in a conditional ternary, but stretched it over multiple lines.

I feel like your very angry for some reason. I got nearly knocked out with a metal door yesterday and got a petty hurtful bruise, so i bet your day is going a lot better than mine. You posted your post like i just went in and changed JS core code itself. You exaggerated basically everything.

Now i’m getting legitimately pissed. It doesn’t take a super computer to check if the string in question is actually a string or a array, and go from there. There is a command called typeof, which can tell the state of the object in question. So i highly bet they are able to defy the laws of physics to tell the difference here with there own coding language.

Your also acting like i hate to code and i want to change JS, which is not what i intended. Its not like i am removing errors here, i’m just questioning errors that appear because the requested change has already happened. I’m trying to simplify something that i see as could be simplified, never said it was correct instantly.

I came across this problem working on the CE for my calculator, and was able to do mostly everything else easily. I only complain, because these are forums. This is where you come to complain or debate about topics. Everything i do post, will be about something I DON’T LIKE OR UNDERSTAND.

Now please, talk to the new guy and provide understandable examples.

OK, man, let us know how that turns out for you.

1 Like

I get why it seems annoying in this instance (specifically join) but you have to have consistency in the language. Without you explicitly telling it, it’s impossible for the program to know in advance that when you’re trying to do something illegal that you want to ignore that illegal thing.

Regarding consistency, if what you want to happen were true, it would have to be true for everything else. So for example, if you tried to divide a number by a string, what would happen? What should it return?

You can’t check every operation, and if it isn’t applicable, just pass through. It is always preferable to error if the operation is illegal, otherwise it is unfeasibly difficult to debug a program. In your scenario, the program won’t tell you if you’re doing something wrong.

The program doesn’t know this. It just executes statements in order. try...catch is there if you really need it, but it for exceptional things; this isn’t exceptional.

1 Like

Programming (any problem solving) can be a rewarding and at times a damned frustrating endeavor. I know. I smashed a keyboard once. I have scratches on my desk and a small scar on my hand to remind me of that everyday.

That said, this thread has really gone off the rails. Maybe a simple restatement of the facts is in order.

  • All arrays share a method join()

  • String objects do not have a method join() (or sort() or map(), or sayHi(), or changeGear())

  • In Javascript when you try to call a method on an instance but that method does not exist a specific error is thrown. That is as designed - a one size fits all solution.

  • Those errors are not handled for you by the Javascript engine but at least you get a notification. They are well documented so that a programmer can choose to (or not) avoid, check for, ignore or handle the case whenever those errors occur.

  • Errors that fail silently are not a good thing. If a program was designed to join an array but a instead received a string (or a number, bool, etc) then something went way wrong and an alarm needs to be raised. If you know that is a possibility beyond your control that exists in your program then have code to handle that gracefully without crashing.

  • Javascript is the way it is - take it or leave it. Free to use as is. In fact, you are free to add your own join( ) method to String in every program you design from here on out so it fails invisibly without bothering you.

  • Arguing about how the internals of the Javascript engine should work is like railing against the sun rising in the east because your house happens to face west. You can shake your fist all you want but it changes nothing.

I know your frustration first hand. Hang in there brother. There’s a prize at the end.

Well normally, unless there is a glitch, the input will always be whats desired after all the bugs are worked out. In my case the input could’ve been both a array and a string. This is because if they pressed the CE of my calculator once, the CE function received a array. The next time it received a string. I just wanted a way to skip over the split(“”) or join(“”) part if it is already true.

Example? :smiley:

I already deleted the function by now considering i’m a ‘bad coder’ since i complain and on the forums about things. I just want people to understand that the whole purpose of forums is to talk about errors and debate things you don’t like or understand. A normal working program goes into service regularly and works as expected, without much talk. Every time you make a working part of your program do you post the code on these forums? No, because its expected to work. You can post projects but not every function.

There would be no need for forums if everything and everyone did perfectly and understood and agreed. I never said i will change Javascript, i asked if there was a way get around my issue and wanted to see what people thought. Of course, since i found logic that makes there job simpler, people get angry and rude. Why worry about certain errors if they can be skipped over since they mean nothing? Less work.

The whole point of technology is to solve a problem. The whole point of that function is to join a string, and if its already joined than its job isn’t needed. This can be used to funnel the inputs and make sure it doesn’t error anything that is useful, like returning the string (which is actually a array) to the client.

I only get mad when people lie, exaggerate, and get rude over something like debating forums. Every hostile forum i have seen just doesn’t allow people to speak there mind to a degree. The Mods rule over the forum, and ban you if you don’t fit there narrative. They are usually always biased towards the well known people of the forum, and hate to listen to anyone else. Luckily this isn’t the case with these forums.