comparisons - "Behaves similar to" or "behaves similarly to"?
I wrote the following comment in a programming forum:
Objects in JavaScript behave similar to a regular associative array.
This is how I would use the word "similar" in normal conversation. However, the dictionary says that "similar" is an adjective, and "similarly" should be used in this context instead:
Objects in JavaScript behave similarly to a regular associative array.
Both constructions look grammatically correct to me, but the second one sounds weird. Searching the internet, I see both "behaves similar to" and "behaves similarly to" are used.
So are both considered grammatically correct?
Answer
In casual speech you can probably get away with similar, but you may sound uneducated to some. Similarly is the correct adverb form, and it does not sound weird. I would always write similarly in this case. The same is true for different and differently.
As a side note, this sentence lacks subject-verb agreement:
Objects in JavaScript behaves similarly to a regular associate array.
It should be:
Objects in JavaScript behave similarly to regular associate arrays.
(Also, the correct term is associative array)
Comments
Post a Comment