JavaScript Tutorial

 

JavaScript Tutorial

JavaScript is often abbreviated as JS. It is a scripting language for the web and supported by most web browsers such as Chrome, Edge, Firefox, etc. All web developers should know the basics of how to read, write, and troubleshoot JavaScript.

This tutorial will start with an introduction to JavaScript and will move through the basic components of the JavaScript language.

Prerequisites

There are no prequisities for this JavaScript tutorial. You should be able to easily understand this tutorial and learn the basic concepts of JavaScript as you progress to the more advanced JavaScript topics.

Now, let's get started learning JavaScript!

Start Tutorial

Or jump directly to a topic in JavaScript:

JavaScript Basics

CommentsCommenting code in JavaScript
LiteralsLiterals such as string, number, boolean and null
Reserved WordsList of reserved words that have special meaning
OperatorsComparison, mathematical and assignment operators
VariablesDeclare variables and assign values
Console LogConsole for debugging and troubleshooting

JavaScript Loops and Conditional Statements

if-elseExecute code based on conditions
switchExecute code based on the value of an expression
while loopExecute code repeatedly (termination condition at start of loop)
do-while loopExecute code repeatedly (termination condition at end of loop)
for loopExecute code repeatedly for a fixed number of times
for-in loopIterate through the properties of an object
breakTerminate a loop early
continueRestart a new iteration of a loop (skipping remainder of current iteration)

JavaScript String Methods

anchorCreate the HTML <a> element (or anchor)
bigCreate the HTML <big> element
blinkCreate the HTML <blink> element
boldCreate the HTML <b> element
charAtRetrieve a character at a specific position in a string
charCodeAtRetrieve a Unicode value for a character at a specific position in a string
codePointAtRetrieve a Unicode code point for a character at a specific position in a string
concatConcatenate strings together
endsWithDetermine whether a string ends with a specific substring
fixedCreate the HTML <tt> element
fontcolorCreate the HTML <font> element with a font color
fontsizeCreate the HTML <font> element with a font size
fromCharCodeCreate a string from a sequence of Unicode values
fromCodePointCreate a string from a sequence of Unicode code points
includesDetermine whether a substring is found in a string
indexOfFind the location of a substring in a string
italicsCreate the HTML <i> element
lastIndexOfFind the location of a substring in a string, searching backwards
localeCompareCompare two strings and determine which string comes first in the sort order (based on locale)
matchFind matches based on regular expression matching
normalizeConvert a string to its Unicode Normalization Form
padEndPad the end of a string with a specific string
padStartPad the start of a string with a specific string
repeatRepeat a string a specified number of times
replaceReplace occurrences of a specified string or regular expression with a replacement string
searchSearch for a specific string or regular expression
sliceExtract a substring from a string
smallCreate the HTML <small> element
splitSplit a string into an array of strings using delimiter
startsWithDetermine whether a string starts with a specific substring
strikeCreate the HTML <strike> element
subCreate the HTML <sub> element
substrExtract a substring from a string given a start position and a length
substringExtract a substring from a string given a start and end position
supCreate the HTML <sup> element
toLocaleLowerCaseConvert a string to lowercase based on a locale
toLocaleUpperCaseConvert a string to uppercase based on a locale
toLowerCaseConvert a string to lowercase
toStringReturn a string representation of an object
toUpperCaseConvert a string to uppercase
trimRemove whitespace characters from start and end of string
trimEndRemove whitespace characters from end of string
trimStartRemove whitespace characters from start of string
valueOfReturn the primitive value of a string object

JavaScript Number Methods

EPSILONReturn the smallest positive number approaching zero
isFiniteReturn a Boolean value indicating whether a value is a finite number
isIntegerReturn a Boolean value indicating whether a value is an integer
isNaNReturn a Boolean value indicating whether a value is of type Number with a value of NaN
isSafeIntegerReturn a Boolean value indicating whether a value is a safe integer
MAX_SAFE_INTEGERReturn the maximum safe integer value
MAX_VALUEReturn the maximum numeric value
MIN_SAFE_INTEGERReturn the minimum safe integer value
MIN_VALUEReturn the smallest positive numeric value
NaNReturn the value that represents Not-A-Number
NEGATIVE_INFINITYReturn the value that represents negative infinity
parseFloatParse a string and return a floating point number
parseIntParse a string and return an integer number
POSITIVE_INFINITYReturn the value that represents positive infinity
toExponentialConvert a number to exponential notation
toFixedConvert a number to fixed-point notation
toLocaleStringConvert a number to a locale-specific numeric representation
toPrecisionConvert a number to a specific precision
toStringConvert a number to a string
valueOfReturn the primitive value of a Number object

JavaScript Math Functions

absReturn the absolute value of a number
acosCalculate the arc cosine of a number
acoshCalculate the hyperbolic arc cosine of a number
asinCalculate the arc sine of a number
asinhCalculate the hyperbolic arc sine of a number
atanCalculate the arc tangent of a number
atan2Calculate the arc tangent of (x,y) coordinates
atanhCalculate the hyperbolic arc tangent of a number
cbrtCalculate the cube root of a number
ceilRound a number up and return an integer value
clz32Count the number of leading zeros in a number represented as 32-bit binary
cosCalculate the cosine of a number
coshCalculate the hyperbolic cosine of a number
EReturn the value of the mathematical constant e
expReturn e raised to the power of number (enumber)
expm1Return e raised to the power of number minus 1 (enumber - 1)
floorRound a number down and return an integer value
froundRound a number to a 32-bit single precision float
hypotReturn the square root of the sum of squares of the parameters provided
imulReturn the 32-bit integer multiplication of two numbers
LN10Return the natural logarithm of 10
LN2Return the natural logarithm of 2
logReturn the natural logarithm of a number
log10Return the base-10 logarithm of a number
LOG10EReturn the value of log10e
log1pReturn the natural logarithm of a number + 1
log2Return the base-2 logarithm of a number
LOG2EReturn the value of log2e
maxReturn the largest value from the numbers provided
minReturn the smallest value from the numbers provided
PIReturn the value of the mathematical constant π (pi)
powReturn m raised to the nth power
randomReturn a random number
roundReturn number rounded to the nearest integer
signReturn a value indicating the sign of a number
sinReturn the sine of a number
sinhReturn the hyperbolic sine of a number
sqrtReturn the square root of a number
SQRT1_2Return the square root of 1/2
SQRT2Return the square root of 2
tanReturn the tangent of a number
tanhReturn the hyperbolic tangent of a number
truncReturn the integer portion of a number

JavaScript Array Methods

concatConcatenate two or more arrays into a new array
copyWithinCopy a portion of an array from one location in the array to another location
entriesReturn a new Array iterator object
everyReturn a Boolean value indicating whether every element satisfies a criteria
fillFill elements of an array with a specified value
filterReturn a new array with only the elements that satisfy a crtieria

Comments

Popular posts from this blog

JavaScript: Comments