In JavaScript Objects are reference types while strings "feel" like reference types somehow (don't forget strings are immutable!). So when you do
var firstPerson = "Manish";
var secondPerson = firstPerson;
secondPerson has the value "Manish". When you then do
firstPerson = "Vikash";
you are creating a new string and firstPerson will have the new string as its value. So secondPerson is not changed at all.
I like the following quote from "JavaScript - The Definitive Guide":
What about strings? A string can have an arbitrary length, so it would seem that strings should be reference types. In fact, though, they are usually considered to be primitive types in JavaScript simply because they are not objects. Strings don't actually fit into the primitive versus reference type dichotomy. We'll have more to say about strings and their behavior a little later.
On the same link you find at 11.2.2. Copying and Passing Strings a great description:
As mentioned earlier, JavaScript strings don't fit neatly into the
primitive type versus reference type dichotomy. Since strings are not
objects, it is natural to assume that they are primitive. If they are
primitive types, then by the rules given above, they should be
manipulated by value. But since strings can be arbitrarily long, it
would seem inefficient to copy, pass, and compare them byte by byte.
Therefore, it would also be natural to assume that strings are
implemented as reference types.
Instead of making assumptions about strings, suppose we write some
JavaScript code to experiment with string manipulation. If strings are
copied and passed by reference, we should be able to modify the
contents of a string through the reference stored in another variable
or passed to a function.
When we set out to write the code to perform this experiment, however,
we run into a major stumbling block: there is no way to modify the
contents of a string. The charAt( ) method returns the character at a
given position in a string, but there is no corresponding setCharAt( )
method. This is not an oversight. JavaScript strings are intentionally
immutable -- that is, there is no JavaScript syntax, method, or
property that allows you to change the characters in a string.
Since strings are immutable, our original question is moot: there is
no way to tell if strings are passed by value or by reference. We can
assume that, for efficiency, JavaScript is implemented so that strings
are passed by reference, but in actuality it doesn't matter, since it
has no practical bearing on the code we write.
In your second example both variables are referencing the same object. If you now change this object through any of the two variables you are still changing the same object. Assigning objects is always by reference and never by value!!!
Conclusion: Although strings are often mentioned to be a primitive type they most probably feel or are implemented as a reference type. It's actually like in Java, but in Java Strings are explicitly reference types!