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?