It's a pretty mundane question, but still i want to know XD thanks in advance


#1


Well, my question is whether having "Hi, I am " + name and "Hi, i am" + " " + name is the same
both nets the same results, but i learnt earlier that i am supposed do to the latter. Maybe maybe not, but i'm curious is it because there are situations where the latter is better than the first line of code.
i thought it was more easier/efficient to just include the space as part of the sentence rather than actually specifying an entire new string.


var nameString = function (name) {
	return "Hi, I am " + name ;
	
};

nameString(Marcus)


#2

No need to treat space like a special character


#3

what do you mean? if you meant that " " is not necessary, why? because they said to do that. though admittedly i don't, instead i just add the space behind the sentence i want printed.


#4

Why not:

return "H" + "i" + "," + " " + "I" + " " +"a" + "m" + " " + name ;

#5

i know i know, i just want to know why the website said to : ("Hi i am" + " " + name) instead of ("Hi i am " + name). if you're just gonna be useless again, dont reply.


#6

That's rather toxic


#7

Just help can? im sorry for being toxic, it just bugs me that people are not helping instead mocking.


#8

You should program yourself to have better social skills.


#9

Guys you are being mean. I agree, saying "Hi, I am " + name is way more efficient the the other one.


#10

thank you kind sir :slight_smile: people like you make the internet alot better XD


#11

Thanks! The thing is, I have yet to see Codecademy accept an instance such as, ("Hi, I am " + name) instead of, ("Hi, I am" + " " + name) Maybe they want to stick in our heads the point of repeating the + in between words. Also ioanatan don't be condescending. Please.


#12

oh they do accept, only in the exercise where they specifically taught you this concept, then they won't accept ("Hi i am " + name), everywhere else they accept.


#13

Ah I see. That is a very interesting concept... Off to the side NOT REALLY


#14

If you wish me to do something differently then you can describe that difference. You mention social skills, if you want something to be different try applying some of that.


#15

Or maybe we can all agree this was the least pragmatic thread ever and settle our differences like normal human beings.


#16

He is not wrong, i read some of your other posts, well i can say you seem pretty ok as a person imho.
However in this thread you decided to be a wise-crack, so im pretty sure he meant that action, since i was asking a question and wished some clarification on it, and you did not provide it, and was being rude about it


#17

I'm reluctant to say any more than the piece of the puzzle that seems to be missing. Here I was looking to question if there was anything at all different about space as a character in a string, if so there's a big misunderstanding in what strings are and you'd have to motivate how it was any different so that the misunderstanding could be cleared out, or you would see that it's just another character and the instructions you referred to were silly.

I generally get more vague as questions get vague, people are always free to explain their thoughts and ask more direct questions, that's how they would solve the issue themselves anyway.

Some will consider the responsibility of providing the right explanation to be mine. I consider it to be yours, because that's how you learn to find things out. This is where teachers will sometimes seem like they are taunting the student, I'm sure you've seen others do this, trying to get the student to ask the right questions. There's another kind of teacher that gives up and just hands over the conclusions. That's not worth my time.. Or yours.


#18

i was just asking whether "Hi i am " or "Hi i am" + " ", which is more efficient, or better to use when writing long programs, perhaps you were trying to get me ask the right questions.
But seriously, seek better methods of doing so. And i did ask a direct question.


#19

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.