Questions and Answers
What is the primary purpose of the 'head' element in an HTML document?
Which JavaScript keyword is used to declare a variable that cannot be redeclared in the same scope?
In HTML, which tag is used to define an ordered list?
Which of the following is NOT a primitive data type in JavaScript?
Signup and view all the answers
What is the purpose of the 'src' attribute in an HTML tag?
Signup and view all the answers
Which JavaScript method is used to access an element by its ID?
Signup and view all the answers
Which of the following describes a 'function-scoped' variable in JavaScript?
Signup and view all the answers
Which of the following elements is considered a semantic HTML5 element?
Signup and view all the answers
Study Notes
HTML Basics
-
Definition: HyperText Markup Language; standard markup language for creating web pages.
-
Structure:
-
Doctype Declaration:
<!DOCTYPE html>
- defines document type. -
HTML Element:
<html>
- root element. -
Head Element:
<head>
- contains meta-information (e.g.,<title>
,<meta>
,<link>
,<script>
). -
Body Element:
<body>
- contains content of the web page (text, images, etc.).
-
Doctype Declaration:
-
Common Tags:
-
Headings:
<h1>
to<h6>
- define headings. -
Paragraph:
<p>
- defines a paragraph. -
Links:
<a href="URL">Link Text</a>
- creates hyperlinks. -
Images:
<img src="URL" alt="description">
- embeds images. -
Lists:
- Unordered:
<ul><li></li></ul>
- Ordered:
<ol><li></li></ol>
- Unordered:
-
Tables:
<table><tr><td></td></tr></table>
- defines tables.
-
Headings:
-
Attributes: Provide additional information about elements, e.g.,
id
,class
,style
,src
. -
Forms:
-
<form>
element for user input; includes<input>
,<textarea>
,<button>
, etc.
-
-
Semantic HTML: Use of HTML5 elements like
<article>
,<section>
,<footer>
,<header>
to improve readability and accessibility.
JavaScript Fundamentals
-
Definition: A high-level, dynamic, untyped programming language primarily used for enhancing web pages.
-
Basic Syntax:
-
Variables: Declared using
var
,let
, orconst
.-
var
- function-scoped, can be redeclared. -
let
- block-scoped, cannot be redeclared in the same scope. -
const
- block-scoped, cannot be reassigned.
-
-
Variables: Declared using
-
Data Types:
- Primitive:
string
,number
,boolean
,null
,undefined
,symbol
. - Objects: Collections of values and more complex entities.
- Primitive:
-
Operators:
- Arithmetic:
+
,-
,*
,/
,%
- Comparison:
===
,!==
,>
,<
,>=
,<=
- Logical:
&&
,||
,!
- Arithmetic:
-
Control Structures:
-
Conditional Statements:
if
,else if
,else
,switch
. -
Loops:
for
,while
,do...while
.
-
Conditional Statements:
-
Functions:
-
Declaration:
function name() { }
-
Expression:
const name = function() { }
-
Arrow Functions:
const name = () => { }
-
Declaration:
-
DOM Manipulation:
- Accessing elements:
document.getElementById()
,document.querySelector()
. - Modifying content:
element.innerHTML
,element.style
. - Event Handling:
element.addEventListener('event', function)
.
- Accessing elements:
-
JSON: JavaScript Object Notation; a format for structuring data as key-value pairs, often used for API responses.
-
ES6 Features:
- Template literals:
`string`
- Destructuring:
const { key } = object;
- Modules:
import
andexport
statements.
- Template literals:
HTML Basics
- HyperText Markup Language (HTML) is the standard markup language for creating web pages.
- The document begins with a Doctype Declaration (
<!DOCTYPE html>
), which defines the document type. - The root element of an HTML document is encapsulated within
<html>
tags. - The
<head>
element contains meta-information such as page title (<title>
), character set (<meta charset>
), and stylesheets (<link>
). - The
<body>
element holds the content visible on the web page, including text, images, and other media. - Headings are defined using tags from
<h1>
to<h6>
, where<h1>
represents the highest importance. - The
<p>
tag defines a paragraph of text. - Hyperlinks are created with the
<a>
tag, utilizing thehref
attribute for the link destination. - Images can be embedded using the
<img>
tag, requiring thesrc
attribute for the image source. - Lists can be unordered using
<ul>
or ordered using<ol>
, with list items defined by<li>
. - Tables are defined using the
<table>
tag, which includes rows (<tr>
) and cells (<td>
and<th>
). - Attributes such as
id
,class
,style
, andsrc
provide additional context and information about elements. - Forms for user input utilize the
<form>
element, incorporating various controls like<input>
,<select>
, and<textarea>
. - Semantic HTML enhances readability and accessibility through elements like
<header>
,<footer>
,<article>
, and<section>
.
JavaScript Fundamentals
- JavaScript is a high-level, dynamic programming language used primarily for enhancing interactivity in web pages.
- Basic syntax involves variable declarations using
var
,let
, orconst
, each with distinct scoping rules. -
var
is function-scoped and can be redeclared, whilelet
andconst
are block-scoped, withconst
not allowing reassignment. - JavaScript has several primitive data types:
string
,number
,boolean
,null
,undefined
, andsymbol
, along with objects that involve collections of values. - Arithmetic operators include
+
,-
,*
,/
, and%
, while comparison operators are===
,!==
,>
,<
,>=
, and<=
. - DOM manipulation enables dynamic changes to the web page by accessing elements with
document.getElementById()
ordocument.querySelector()
. - Content can be modified using
element.innerHTML
orelement.style
, and event handling can be done withelement.addEventListener('event', function)
. - JSON (JavaScript Object Notation) is a format for structuring data in key-value pairs, widely used for API responses.
- ES6 features include template literals for string interpolation (
``string``
), destructuring assignment (const { key } = object;
), and module system usingimport
andexport
statements.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge on the fundamentals of HyperText Markup Language (HTML) with this quiz. Explore key concepts such as document structure, common tags, and HTML elements. Perfect for beginners and web development enthusiasts.