Save
BSIT
Web Technology
JavaScript
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Kuriseru Uchi
Visit profile
Cards (18)
JavaScript accepts both
double
and
single
quotes, but it is recommended to use single quotes for clarity.
<script
type=“text
/
javascript”
> is an old type of JavaScript attribute that is now considered obsolete
One of many JavaScript HTML methods is
getElementByld
(
)
In
HTML
, JavaScript code is inserted between <
script
> and </
script
> tags.
A JavaScript
function
is a block of JavaScript code, that can be executed when "called" for.
Scripts can be placed in the <
body
>, or in the
<head
> section of an HTML page, or in both.
JavaScript files have the
file
extension .js.
Writing into an HTML element, using innerHTML.
Writing into the HTML output using
document.write
(
)
Writing into an alert box, using window.alert()
Writing into the
browser console
, using
console.log
(
)
function myFunction
(
)
is used to create function in JavaScript.
Code after double slashes // or between /* and */ is treated as a comment
JavaScript
is the same as Java.
onClick
is the
event
occurs when the user clicks on an HTML element
An
equal
sign is used to assign values to
variables.
JavaScript uses the keywords
var
,
let
and
const
to declare variables.
All JavaScript
identifiers
are
case
sensitive.