So for each $ in replace.

Gierisch: Thats what it supposed to do

Kalinoski: The local variables get lost after you return

Thach: Nucleartide: that’s probably the best marketing line in the history of languages

Tourikis: Codecutter, if they are local, then you can’t use them outside. they wouldn’t be local if they were accessible outside

Sarkis: Thach Absolute0:

Kalinoski: If you want message to be an object with a hasMessage property, you have to construct an object and ***ign hasMessage to it

Marbach: Yansanmo: i mean local to the parent of message unc

Kalinoski: Then return that from your closure

Goslee: Return { hasMessage: hasMessage, value: tokens.join’ ‘ };

Mate: Woelfel: ReferenceError: Regexp is not defined

Mate: Woelfel: string ‘$$$$!’

Kirner: Woelfel, if you want to test, use your own browser

Berardo: Woelfel, if you want to show something to someone, you can use the bot

Woelfel: Yansanmo: ok – found it!

Thach: Hannibal_Smith: what am I watching.jpeg

Mate: Woelfel: string ‘$$$$!’

Woelfel: It doesn’t replace, it appends

Schmeltzer: Woelfel, your string is wrong

Woelfel: I need to use RegExp because I handle with variables

Philo: Kalinoski: i thought thats what I was doing

Saldibar: Woelfel, yes, inside a string $ is $

Woelfel: It should find the four $$$$ and replace them with !

Merren: So your string is wrong, a regexp need $ not $

Woelfel: You mean this part?: RegExp”$$$$”,

Woelfel: Or do you mean the input string?

Woelfel: Ok, why two backslashes? :O

Kalinoski: Codecutter you are returning a string

Youngquist: Woelfel, that’s how string works in JS

Woelfel: So $ also got a special meaning in a javascript stirng then

Woelfel: Ok, this is confusing now

Pasana: Woelfel, you are focusing on the wrong thing

Woelfel: Ok, I have to escape the backslash

Kalinoski: Woelfel has a special meaning in a string

Woelfel: Otherwise it won’t appear

Micheletti: Kalinoski: i see, how do i return the object instead?

Klint: Woelfel, in a string is an escape character “$” is $ “$” is $

Kalinoski: Codecutter: return { value: tokens.join” “, hasMessage: hasMessage }

Hardenbrook: Kalinoski, it’s better if you put hasMessage before :-

Mckone: Alphabetical properties order you know :-p

Redlin: How can i write the lines in this fiddle shorter?

Woelfel: Yansanmo: ok, I found the mistake now – and a nice twist

Woelfel: You see what the traitorbot does to me?!

Hubler: Woelfel, you don’t escape the second argument of replace

Woelfel: But replace is a string I thought?

Kalinoski: Yansanmo hehe perfectionist

Montano: Woelfel, do you forget everything we say ?

Woelfel: The second string is the replace string

Pam: Kalinoski, I say that, because I said the same thing 7 minutes ago

Woelfel: But the string that replaces the matches of the regexp

Woelfel: So why do I have to escape something? I thought $ alone is not needing escaping

Recine: Woelfel, did you read the link i gave you before ?

Woelfel: I guess so, I read them all

Wielgasz: Woelfel, they say that in the second argument, if you want a “$” you need to use “$$”

Woelfel: So for each $ in replace string I need two $ then