Let's go back over to our code editor, we're going to update that selector and add in some non-working
copies of the show function.
OK, so back over here, here's our cumulative code array and here's the copy of the show function that
actually works.
It actually does something.
I'm going to take this entire string.
So there's the entire multiline string, I'm going to cut it.
And then I'm going to piece that in right above our cumulative coterie, and we'll call it show funk.
So your show function, I'm assigning it that multiline string.
Then right after that, I'm going to declare another variable called Show Funk No.
So the idea here is that show funk, no up, no OP stands for no operation.
It doesn't do anything when it is called.
And I'm going to define this as our show is an empty function.
You'll notice I'm using the keyword here bar for declaring this array.
The reason for that is that you can declare a variable with the keyword bar as many times as you wish.
But if you would try to consistently or continually re declare a variable using const Aulet, you'll
very quickly get an error message saying that this variable has already been declared.
We do need to go back up to the original show function up here, make sure we find the const show right
here as well.
And I'm also going to update that to be var show.
OK, so now down inside of our Falu.
We're going to find our cumulative code right here.
So if we have a code cell, we're going to take a look at the ID of the cell, we're going to see if
the idea the cell is the one that we are trying to execute, if we are, then we're going to add in
the real version of our show function.
Otherwise, we're going to add in the no up version.
We're going to say if ID.
Is equal to sell dot ID, that means that this is the cell that we want to give a real version of the
show function to put in a cumulative code that push.
So unk.
Otherwise, this must be a previous cell.
We do not want to provide any kind of Runnable code here.
We'll put in a cumulative OWD Bush show funk.
No.
Now, you will notice we're getting a little bit of an air here, that's just because I've left a comma
inside of cumulative code right there to remove that in the air goes away.
OK, that looks good.
Let's save this, look back over and do a quick test.
Now, back over, I'll do a quick refresh.
And I should be able to do a show of an H1.
That says hi there or whatever else.
And then if I go down to the next code cell, I no longer see I there appear on the screen.
So we only see this show in vote for the current preview window.
I should be able to add in another showdown here with a totally different one.
And say something else.
And I still see that appear.
I should also be able to add in some additional code cells and each one that I add in should not have
any printouts or any show content inside of those until I start to add in a show for that very particular
code.
So I'll update this one to say middle.
So.
Yep, looks good.
OK, well, that's pretty much it.
Well, I think we've got a really good working version of the show function here.
The last thing we really need to do is a little bit of code cleanup.
So right now, this entire selecter is just very, very large and it's all inside of a code cell component.
The last thing I really want to do is extract the selector into some other file just so we have one
location for all this logic around finding the cumulative code for cell and then injecting all this
show related stuff into it.