Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Champe Chilufya
Champe Chilufya
1,349 Points

Rerun code in chrome?

I was wondering if there a way to run the code i have put into chrome from the start - I normally input it in steps but as soon I press enter it runs the code. for example "let name =prompt (what is your name" - I would like to store this and use it later on and then test the entire code after - but chrome runs it first line as soon as I press enter

2 Answers

You could put it in a function and then when you need it call it

Champe Chilufya
Champe Chilufya
1,349 Points

Brilliant I think that would work to be honest thanks

If you press Shift+Enter you go to a new line

Champe Chilufya
Champe Chilufya
1,349 Points

Thank you that helps... but doesn't that mean there isn't a way to run the code again from the beginning once it has run once ?