0

I'm logging a jQuery object, which assigns to

eg: $obj = <div></div>

if I

 log $obj

I get ''

 <div></div> 

, which is what I need. But when I

 Log 'some string' + $obj

I get this

  [ object, object]

which is not what I want. How do I get the normal log

1 Answer 1

3

Don't use +; that will convert both to strings, giving you an unhelpful representation. Instead, pass two arguments into console.log:

console.log('a string', $obj);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.