Loading video...


Functions as UI

Make our app display the text "Hello Python" using the function getLanguage.

Make sure to use the string ("python") that is already within the function. Use it to create the desired output in the h1.


In our app, we're displaying an h1 using JavaScript. And if we want to change the string content here, for example, to say "Hello JavaScript", that's going to change what we see in the HTML.

But this is entirely static. So to make this dynamic, we can create a variable called language, we can take this value, put string value in the language variable, and output it here.

To do that easily, we can use backticks, called template literals. And then insert our value using this dollar sign and curly brace syntax ${}, and then just put in whatever dynamic value we want. In this case, its language.

So now if we were to say, "Hello Python", this would update the UI.

In this challenge, you need to display the text content that we just had ("Hello Python"), but using this function.