How to load file into Chrome Dev Tools Console?

I’m working through the Ultimate JS Part 1 course and am doing the practice exercises for the lesson on Arrays. Specifically, for the exercise: ‘18- Exercise 2- Includes’, it appears that Mosh is executing the code for index.js directly in the browser console. Can someone please explain how this is done?

I’ve seen various ways to include a JS file within the dev tools console using document.write(), appendChild() or fetch() methods, but the code within the video doesn’t show that any of these techniques are used, so I’m unclear on how the code is being executed.

Usually, you would have an HTML file and you would connect your Javascript file to that which would execute your code from there.

@Kamatz, right I agree with you there. It’s just that I noticed it doesn’t appear to be the way Mosh is doing it during the lesson. You’ll notice in the screenshot the file is index.js, not index.html. How do we accomplish that?

See chapter 3 and 5 for setup with index.html and index.js.
The console.log in line 4 outputs to console.

Great, thank you! I’ll go back and have a look.

Was there any follow-up to this? I am having the same problem and i’ve gone through getting started 3-5 and am still at a loss for how to get the console to display on Chrome from .js instead of .html

It is working for me, could you please share the screenshot of the HTML and JS code.