You are watching: What does js mean in text
|Basic computer system literacy, a basic understanding the HTML and also CSS.|
The 3 layers construct on top of one one more nicely. Let"s take a straightforward text label as an example. We have the right to mark it up utilizing HTML to offer it structure and purpose:
p>Player 1: Chrisp>
Then us can include some CSS into the mix to get it feather nice:
p font-family: "helvetica neue", helvetica, sans-serif; letter-spacing: 1px; text-transform: uppercase; text-align: center; border: 2px hard rgba(0,0,200,0.6); background: rgba(0,0,200,0.3); color: rgba(0,0,200,0.6); box-shadow: 1px 1px 2px rgba(0,0,200,0.4); border-radius: 10px; padding: 3px 10px; display: inline-block; cursor: pointer;
const para = document.querySelector("p");para.addEventListener("click", updateName);function updateName() let name = prompt("Enter a new name"); para.textContent = "Player 1: " + name;
Try clicking on this last version of the text label to view what wake up (note additionally that girlfriend can uncover this demo on GitHub — watch the resource code, or operation it live)!
So what have the right to it really do?
APIs room ready-made to adjust of code structure blocks that enable a hunterriverpei.com to implement programs that would certainly otherwise be difficult or impossible to implement. They execute the exact same thing because that programming that ready-made furniture kits carry out for home building — it is much much easier to take it ready-cut panels and screw them with each other to do a bookshelf 보다 it is to work-related out the style yourself, go and also find the correct wood, cut all the panels to the appropriate size and also shape, find the correct-sized screws, and then put them with each other to make a bookshelf.
They generally loss into 2 categories.
Browser APIs are constructed into your net browser, and are maybe to expose data indigenous the surrounding computer environment, or carry out useful complex things. Because that example:
Note: numerous of the over demos won"t job-related in one older browser — once experimenting, it"s a good idea to use a modern-day browser like Firefox, Chrome, leaf or Opera to operation your password in. Girlfriend will require to think about cross internet browser testing in more detail once you acquire closer come delivering production code (i.e. Actual code that real customers will use).
Third party APIs space not constructed into the internet browser by default, and you typically have to grab their code and also information from what on the Web. Because that example:
Note: these APIs space advanced, and we"ll no be covering any kind of of these in this module. You can find out much much more about these in our Client-side internet APIs module.
Each web browser tab has its own separate bucket because that running password in (these buckets are called "execution environments" in technological terms) — this means that in most cases the password in every tab is run completely separately, and the code in one tab can not directly affect the password in another tab — or on another website. This is a an excellent security measure — if this were no the case, climate pirates can start composing code to steal details from various other websites, and other such bad things.
Note: there are ways to send code and also data in between different websites/tabs in a for sure manner, but these are advanced techniques that we won"t sheathe in this course.
const para = document.querySelector("p");para.addEventListener("click", updateName);function updateName() let surname = prompt("Enter a new name"); para.textContent = "Player 1: " + name;
Here us are picking a message paragraph (line 1), climate attaching an occasion listener to it (line 3) therefore that once the paragraph is clicked, the updateName() code block (lines 5–8) is run. The updateName() code block (these species of reusable password blocksare referred to as "functions") asks the user because that a brand-new name, and then inserts the name right into the paragraph to upgrade the display.
If you swapped the bespeak of the first two lines of code, it would certainly no longer work — instead, you"d acquire an error returned in the browser hunterriverpei.com console — TypeError: para is undefined. This means that the para thing does not exist yet, so we can"t include an event listener come it.
Note: This is a really common error — you should be careful that the objects referenced in your password exist prior to you shot to execute stuff come them.
Interpreted versus compiled code
You might hear the terms interpreted and also compiled in the paper definition of programming. In understood languages, the password is run from optimal to bottom and also the result of to run the code is automatically returned. Friend don"t need to transform the code into a different kind before the browser runs it. The password is obtained in that is programmer-friendly text type and processed directly from that.
Compiled languages on the other hand are transformed (compiled) into another kind before they space run by the computer. Because that example, C/C++ space compiled into maker code the is then operation by the computer. The regimen is executed from a binary format, i m sorry was produced from the original program source code.
There are benefits to both types of language, but we won"t comment on them ideal now.
Server-side versus client-side code
Dynamic versus revolution code
See more: How Old Do You Have To Be To Buy A Bong S In California If Under Age Of 21
A web page through no dynamically updating content is referred to as static — it simply shows the same content every the time.