Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In matlab one could type in the following and get the following reply:

matlab> 1+1
ans = 2 

One could then all the last returned object by simply typing:

matlab> ans 
ans = 2 

That is, the last output seems to be saved in an object named ans. For this rather useful if you are playing around with a little code for some rapid prototyping.

I now wonder if ipython, irb and javascript in the chrome dev tools console have similar functionality and if so, how to call it.

share|improve this question
up vote 1 down vote accepted

In the Chrome Developer Console, whenever you select a value, or an element, you can re-display it by typing $_.

Try this:

  1. Go into Chrome Development Tools on this page
  2. Open the console
  3. Type $("code"), for example - will show all the code elements on the page
  4. Type $_ and you'll see the exact result again

Try your sample: type 1 + 1 -> yields 2. Type $_ -> 2.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.