This page shows the contents of the Book Javascript tips.
Please be aware that these texts contain the non-edited versions. The program snippets are tested and ok but the texts are un-edited.
When a chapter is completed you can find its context here.
You can find the actual tips on the associative pages in the menu on the left.
117 Array Tips
+ With an array concats to a string
A different way to adress array elements
Add an element to an array
Add an element to an array at a pre-defined location
Add an element to an array only if it is new
Append an array to another array
Append an array to another array method 2
Append an array to another array method 3
Associative array
Build a 2 dimensional array
Check for double elements in an array
Check for double elements in an array 2
Convert an array to an CSV string
Convert an array to a string
Convert an array to a string 2
Convert an array to an object
Convert an array to an object 2
Convert an array to only strings
Convert an array with strings to an array with numbers
Convert ar array with strings to an array with numbers 2
Convert an array with numbers to an array with strings
Count the unique items in an array
Copy an array
Copy an array 2
Copy part of an array
Copy the positive elements from an array in a new array
Copy all even numbers into a new array
Create an array and fill it with one value
Create an array and fill it with x unique numbers
Delete clears an element
Empty an array
Exchange two array elements
Exchange two array elements 2
Exchange array elements from 2 array's
Fill an array with the numbers 0 till a max value
Fill an array with the numbers 0 till a maximum value 2
Filter even numbers from an array
Filter negative values from an array
Filter values from an array
Find an element in an array
Find an object in an array
Find the missing numbers in an integer array
Flatten an array
Functions inside an array
Get a random value out of an array
Get an element from the end of an array
Get the diagonal values out of a 2 dimensional array
Get elements that occur in two arrays
Get elements that occur in array 1 but not in array 2
Get the last element of an array
Get the last x elements out of an array
Get the lowest and highest values in an array
Javascript code in an array element
Move an element in an array to a new index
Move an element to the first location in an array
Optimising array loops
Process two arrays of different length
Put the array values in a random sequence
Put the array values in a random sequence 2
Que simulation
Remove and modify array elements with one command
Remove duplicates from an array
Remove duplicates from two arrays
Remove double entries from an array
Remove elements from an array
Remove falsey values from an array
Remove one or more elements from an array
Remove the first x elements from an arry
Remove the last x elements from an array
Remove the last x elements from an array 2
Remove the second last element from an array
Rotate the last array element to the front
Rotate the first array element to the back
Reverse an array
Reversing an array
Search a string in a multidimensional array
Search an array
Search and remove an item in an array
Shuffle the array elements
Skip array element with destructuring
Sort a multidimensional array
Sort a 2d array on its second element
Sort an array according to the length of its elements
Sort an array by the dates in elements
Sort an array case insensitive
Sort an array with numbers
Sort an array descending
Sorting an array while creating a new array
Sorting an array while creating a new array with JSON
Sort an array such that odd numbers occur first
Sort an array that includes subarrays
Sort an array with objects on a property
Sort an array depending on values of another array
Sorting an array with words with accents
Split an array in half
Split an array in parts
Sum the figures in an array
Stack creation
Test if a value occurs in an array
Test if an array has empty elements
Test if an element exists and give the next one in line
Test wether a variable is present in a flat array
Test if two array's are equal
Test if two array's are equal 2
Test if two arrays contain the same elements
Test wether an array contains the elements of another array
Test wether an array contains the elements of another array 2
Three methods to iterate over an array with a for loop
Universal array sorter
Use an array to store your functions.
Using text as array index
Using the array map method
Walk through all array elements
What is the largest number in an array
What is the second largest number in an array
What is the smallest number in an array
Where to find the lowets and highest values in an array
+ With an array concats to a string
A different way to adress array elements
Add an element to an array
Add an element to an array at a pre-defined location
Add an element to an array only if it is new
Append an array to another array
Append an array to another array method 2
Append an array to another array method 3
Associative array
Build a 2 dimensional array
Check for double elements in an array
Check for double elements in an array 2
Convert an array to an CSV string
Convert an array to a string
Convert an array to a string 2
Convert an array to an object
Convert an array to an object 2
Convert an array to only strings
Convert an array with strings to an array with numbers
Convert ar array with strings to an array with numbers 2
Convert an array with numbers to an array with strings
Count the unique items in an array
Copy an array
Copy an array 2
Copy part of an array
Copy the positive elements from an array in a new array
Copy all even numbers into a new array
Create an array and fill it with one value
Create an array and fill it with x unique numbers
Delete clears an element
Empty an array
Exchange two array elements
Exchange two array elements 2
Exchange array elements from 2 array's
Fill an array with the numbers 0 till a max value
Fill an array with the numbers 0 till a maximum value 2
Filter even numbers from an array
Filter negative values from an array
Filter values from an array
Find an element in an array
Find an object in an array
Find the missing numbers in an integer array
Flatten an array
Functions inside an array
Get a random value out of an array
Get an element from the end of an array
Get the diagonal values out of a 2 dimensional array
Get elements that occur in two arrays
Get elements that occur in array 1 but not in array 2
Get the last element of an array
Get the last x elements out of an array
Get the lowest and highest values in an array
Javascript code in an array element
Move an element in an array to a new index
Move an element to the first location in an array
Optimising array loops
Process two arrays of different length
Put the array values in a random sequence
Put the array values in a random sequence 2
Que simulation
Remove and modify array elements with one command
Remove duplicates from an array
Remove duplicates from two arrays
Remove double entries from an array
Remove elements from an array
Remove falsey values from an array
Remove one or more elements from an array
Remove the first x elements from an arry
Remove the last x elements from an array
Remove the last x elements from an array 2
Remove the second last element from an array
Rotate the last array element to the front
Rotate the first array element to the back
Reverse an array
Reversing an array
Search a string in a multidimensional array
Search an array
Search and remove an item in an array
Shuffle the array elements
Skip array element with destructuring
Sort a multidimensional array
Sort a 2d array on its second element
Sort an array according to the length of its elements
Sort an array by the dates in elements
Sort an array case insensitive
Sort an array with numbers
Sort an array descending
Sorting an array while creating a new array
Sorting an array while creating a new array with JSON
Sort an array such that odd numbers occur first
Sort an array that includes subarrays
Sort an array with objects on a property
Sort an array depending on values of another array
Sorting an array with words with accents
Split an array in half
Split an array in parts
Sum the figures in an array
Stack creation
Test if a value occurs in an array
Test if an array has empty elements
Test if an element exists and give the next one in line
Test wether a variable is present in a flat array
Test if two array's are equal
Test if two array's are equal 2
Test if two arrays contain the same elements
Test wether an array contains the elements of another array
Test wether an array contains the elements of another array 2
Three methods to iterate over an array with a for loop
Universal array sorter
Use an array to store your functions.
Using text as array index
Using the array map method
Walk through all array elements
What is the largest number in an array
What is the second largest number in an array
What is the smallest number in an array
Where to find the lowets and highest values in an array
5 Communication tips
CSV to array
Encode a string for sending data
Decode a received string
Mask an email adres
What is my ip adress
CSV to array
Encode a string for sending data
Decode a received string
Mask an email adres
What is my ip adress
49 Date and time tips
Advance the time with x seconds
Advance the time with 30 minutes
Advance the time by one day
Change 24hours notation to 12 hours
Comparing dates
Comparing dates 2
Comparing dates 3
Convert a certain time to seconds
Converts seconds to hours and minutes
Convert the date to every day speech
Create a random date
Each day of the week another function or value or picture
Find the first and last day of the month
Get the users timezone
Generate a random new date from a starting date
Give me the date of tomorrow or 20 days from now
Give me the name of the month
Give me yesterdays date or that of 20 days ago
Give me the date over 4 months or 3 Year
How many days between two dates
How many days between two dates 2
How many days in a specific month
How many months between two days
How many minutes between two dates
How many seconds between two dates
How many hours between two days
How many years between two dates
In what quarter do we live
In which century do we live
In which century do we live 2
Is January first a Sunday ?
Is the given day a weekday or in weekend
Is this year a leapyear
Is this year a leapyear
Make a copy of a date
Measure how long an action takes
Put a clock on your screen
Set a date to midnight
Show minutes with two figures
Test if a date preceeds another date
Test if a date is between two other dates
What day is it in x days
What day is it today
What day is it today 2
What is todays date
Which date of two dates is the most recent
Which day in the year is it
Which of the x days is the most recent
Which year is it
12 Function Tips
A function in a variable
Call a function with a condition
Call a function with an unknown number arguments
Call a function with an unknown number arguments 2
Call a function with default arguments
Convert a string into a function
How to bypass a default parameter
Repeat a function regularly
Repeat a function regularly x times
Stop a function in an interval
Test if an argument is passed to a function
Warning if a parameter is forgotten in a function call
A function in a variable
Call a function with a condition
Call a function with an unknown number arguments
Call a function with an unknown number arguments 2
Call a function with default arguments
Convert a string into a function
How to bypass a default parameter
Repeat a function regularly
Repeat a function regularly x times
Stop a function in an interval
Test if an argument is passed to a function
Warning if a parameter is forgotten in a function call
133 HTML tips
A clear method to display your data
Activate a link at a certain time
Add an element to the bottom of a page
Add an element to a list
Add an element to a list 2
Add or remove an event listener to an element
Add or remove a class
Add text to an element
Alert the user when he uses page-back
Allow just one click on a button
Alter the onclick function
Automatically jump to the previous page
Automatically invoke the current year
Blocking an input field
Change a texts attributes
Change an image into another
Change an elements id
Change the attributes of a text on a page
Change the background color of a webpage
Change the background color of a webpage 2
Change the background color of an element
Change the background color by clicking a button
Change the background color with a drop-down menu
Change the backgroundcolor on a page every x seconds
Change the background of an input field after it is filled in
Change the color of an element by hovering the mouse over it
Change the color of several elements on a webpage
Change the font size and color of an element on a webpage
Change the mouse-pointer
Change the size of an image
Change the space between words
Change the text of a button
Change the text on a page
Change your text in bold
Clearing part of a webpage
Create a list and add entries
Create a random color
Click on a button and execute a function delayed
Copy a text to multiple elements
Copy a text to the clipboard
Count how many times the user scrolls up or down
Create a new DOM element and give it an ID
Create a paragraph on your webpage
Delete an element from the page
Different functions at clicking a button
Disable a button
Disable an eventlistener
Disable the CTRL key
Disable double clicking a button
Disabeling the right mouse button
Disable selecting and copying text with CSS
Disable selecting and copying text with Javascript
Display a scrolling text
Displaying text faster and faster
document.getElementById("ID of element") is not perse needed
Enable or disable buttons or input fields
Fill a table with an array
Flatten an array
Force focus to an inputfield
Format HTML code in a string with multiple lines
Get a selected text
Get a value from a table
Get mouse coordinates in the page or in an element
Get the dimensions of an img that is not yet loaded
Get the screen resolution
Get or loose hint in imput field
Hide an element by clicking on the webpage
Hide an element by clicking on a button
Hide multiple elements on a page
How long is user on the webpage
How many elements in a drop dow list
How many images on this page
How many rows in a table
innerHTML not always shows all information
Input does not use innerHTML
Input field with increase and decrease
Insert a new element before or after another element
Insert a row into a table
Make a table from a fetched JSON file
Make page element appear and disappear
Make page element appear and disappear 2
Move the caption of a table
Move the mouse over an element to jump to another webpage
Move the mouse over an element to trigger a function
Open a new webpage
Open a new webpage 2
Password protected page
Prevent space from scrolling
Printing the current page
Put a comma seperated text as a list on screen
Put an element at an X-Y co-ordinate in the window.
Refresh the page
Remove alements between two elements
remove an element from the webpage
remove an element from the webpage 2
Remove an option from the drop-down menu
Repeatedly react on addEventListener()
Replace an image with another
Replace an image with another 2
Rotate the complete webpage
Rotate an object on a webpage to draw attention
Run two functions with one button click
Run a function when the window closes
Set or clear a radiobutton
Set the maximum length of an input field
Scroll to the top of a page
Scroll to the bottom of a page
Select any tekst on your screen and use it
Show a message if the drop-down menu selection has changed
Show one or multiple alerts when a page is opened
Show or hide an element on the webpage
Show or hide the contents of an inputfield
Show when page is last changed
Simulate a click on an element
Start a function immediately if page is loaded
Start a function when the whole page has loaded
Start multiple functions with one mouse-click
Test for an empty INPUT field
Test if a button was clicked
Test if a key was pressed
Test if a key was pressed and which key that was
Test if the Alt, Control or Shiftkey is pressed
Test if the checkbox is checked
Test if the ENTER key was pressed in an input field
Test if the window has changed size
Test wether Javascript is activated or not
Three methods to generate a click event
Trigger a button click
Wait a certain amount of time
Wait a certain amount of time 2
What choice was made in a drop-down menu
Which page is this
Which key was pressed
Which key was pressed 2
A clear method to display your data
Activate a link at a certain time
Add an element to the bottom of a page
Add an element to a list
Add an element to a list 2
Add or remove an event listener to an element
Add or remove a class
Add text to an element
Alert the user when he uses page-back
Allow just one click on a button
Alter the onclick function
Automatically jump to the previous page
Automatically invoke the current year
Blocking an input field
Change a texts attributes
Change an image into another
Change an elements id
Change the attributes of a text on a page
Change the background color of a webpage
Change the background color of a webpage 2
Change the background color of an element
Change the background color by clicking a button
Change the background color with a drop-down menu
Change the backgroundcolor on a page every x seconds
Change the background of an input field after it is filled in
Change the color of an element by hovering the mouse over it
Change the color of several elements on a webpage
Change the font size and color of an element on a webpage
Change the mouse-pointer
Change the size of an image
Change the space between words
Change the text of a button
Change the text on a page
Change your text in bold
Clearing part of a webpage
Create a list and add entries
Create a random color
Click on a button and execute a function delayed
Copy a text to multiple elements
Copy a text to the clipboard
Count how many times the user scrolls up or down
Create a new DOM element and give it an ID
Create a paragraph on your webpage
Delete an element from the page
Different functions at clicking a button
Disable a button
Disable an eventlistener
Disable the CTRL key
Disable double clicking a button
Disabeling the right mouse button
Disable selecting and copying text with CSS
Disable selecting and copying text with Javascript
Display a scrolling text
Displaying text faster and faster
document.getElementById("ID of element") is not perse needed
Enable or disable buttons or input fields
Fill a table with an array
Flatten an array
Force focus to an inputfield
Format HTML code in a string with multiple lines
Get a selected text
Get a value from a table
Get mouse coordinates in the page or in an element
Get the dimensions of an img that is not yet loaded
Get the screen resolution
Get or loose hint in imput field
Hide an element by clicking on the webpage
Hide an element by clicking on a button
Hide multiple elements on a page
How long is user on the webpage
How many elements in a drop dow list
How many images on this page
How many rows in a table
innerHTML not always shows all information
Input does not use innerHTML
Input field with increase and decrease
Insert a new element before or after another element
Insert a row into a table
Make a table from a fetched JSON file
Make page element appear and disappear
Make page element appear and disappear 2
Move the caption of a table
Move the mouse over an element to jump to another webpage
Move the mouse over an element to trigger a function
Open a new webpage
Open a new webpage 2
Password protected page
Prevent space from scrolling
Printing the current page
Put a comma seperated text as a list on screen
Put an element at an X-Y co-ordinate in the window.
Refresh the page
Remove alements between two elements
remove an element from the webpage
remove an element from the webpage 2
Remove an option from the drop-down menu
Repeatedly react on addEventListener()
Replace an image with another
Replace an image with another 2
Rotate the complete webpage
Rotate an object on a webpage to draw attention
Run two functions with one button click
Run a function when the window closes
Set or clear a radiobutton
Set the maximum length of an input field
Scroll to the top of a page
Scroll to the bottom of a page
Select any tekst on your screen and use it
Show a message if the drop-down menu selection has changed
Show one or multiple alerts when a page is opened
Show or hide an element on the webpage
Show or hide the contents of an inputfield
Show when page is last changed
Simulate a click on an element
Start a function immediately if page is loaded
Start a function when the whole page has loaded
Start multiple functions with one mouse-click
Test for an empty INPUT field
Test if a button was clicked
Test if a key was pressed
Test if a key was pressed and which key that was
Test if the Alt, Control or Shiftkey is pressed
Test if the checkbox is checked
Test if the ENTER key was pressed in an input field
Test if the window has changed size
Test wether Javascript is activated or not
Three methods to generate a click event
Trigger a button click
Wait a certain amount of time
Wait a certain amount of time 2
What choice was made in a drop-down menu
Which page is this
Which key was pressed
Which key was pressed 2
43 Number tips
0 before a number changes it to base 8
Add true to a number
Convert a binary to an integer
Convert an integer to a float
Convert a number to binary
Convert a number to an integer
Convert a number to a string
Convert a number to a string 2
Count the amount of digits in a number
Create even numbers
Create odd numbers
Get a figure out of a string
Get all primenumbers up until a certain value
How many figures after the decimal point
Random number from 1 to N
Random number from X to Z
Random number within a range
Random number with 5 digits
Remove the last x figures of a number
Remove the leading 0
Reverse a number
Round a number so it is divisible by x
Round a number to 0.05
Round a number to 0.10
Round a number to 0.20
Round a number to 0.25
Round a number to 0.50
Rounding to a fixed number decimals
Rounding with toFixed changes a number into a string
Split a number before and after comma
Split a number in it's figures
Split a number in thousands, hundreds etc.
Test if a number is an integer
Test wether a number is an integer 2
Test if a number is positive or negative
Test wether the input is a number
Test if a variable is a number
Test if a variable is a number 2
Test for even or odd
Test for prime number
Underscore in a number
Use + to convert a string into a number
Using switch-case with comparisons
32 Object tips
Access the values of an object from within another object
Add an element to an object
Add properties of an object to another object
Be carefull at combining objects
Calculate the average value in an array with objects
Convert an array with paired elements to an object
Convert an array with objects to an array
Convert an object to an array
Copy an object
Get the highest value out of an object
Get the number of keys of an object
Get objects out of an array with objects
Get relevant info out of a JSON object
Get the maximum value out of an array with objects
Get the values of an object out of an array with objects
Get the values or keys from an object out of an array
Get values out of an object with arrays
Iterate over an object
How to change the property of a nested Object
How many keys are there in an object
Merge multiple objects into one
Merge multiple objects into one 2
Pretty print objects
Remove a function from an object
Remove a key and value from an object
Remove duplicates from an array with objects
Sort an array of objects on a key
Store objects in localstorage
Test if a key exists
Test if an element exists in an array with objects
Test if an object is empty
Test wether two objects are fully identical
Access the values of an object from within another object
Add an element to an object
Add properties of an object to another object
Be carefull at combining objects
Calculate the average value in an array with objects
Convert an array with paired elements to an object
Convert an array with objects to an array
Convert an object to an array
Copy an object
Get the highest value out of an object
Get the number of keys of an object
Get objects out of an array with objects
Get relevant info out of a JSON object
Get the maximum value out of an array with objects
Get the values of an object out of an array with objects
Get the values or keys from an object out of an array
Get values out of an object with arrays
Iterate over an object
How to change the property of a nested Object
How many keys are there in an object
Merge multiple objects into one
Merge multiple objects into one 2
Pretty print objects
Remove a function from an object
Remove a key and value from an object
Remove duplicates from an array with objects
Sort an array of objects on a key
Store objects in localstorage
Test if a key exists
Test if an element exists in an array with objects
Test if an object is empty
Test wether two objects are fully identical
64 String tips
Add a word or character at a certainh position in the string
Build a string with n letters
Build a string with n words
Change the first letter of every word in uppercase
Change the first letter in a string to uppercase
Convert an array into a string
Convert a name to initials
Convert a string to an array
Fixed length strings
Generate a random password
Getting all figures in a text
Get an amount out of a text
Get the first word of a string
Get the last word of a string
Get the last word in a string 2
Get the last x letters out of a string
How to check if a string only contains all the same characters
How many times do a letter or word appear in a string
How many times does a letter occur in a string
How many times does a letter occur in a string 2
How many times does a string occur in another string
Insert a variable into a string
Loop over a string
Make sure the first letter after a colon is a capital
new String creates an object
Quotes in a string
Remove all non numeric characters except the dot
Remove everything except the letters from a string
Remove everything after a word or character
Remove the first x characters from a string
Removing non alphabetic chracters from a string
Remove numbers from a string
Remove spaces in front and after a string
Remove the first and last characters from a string
Remove the first n words out of a string
Remove the last word from a string
Remove the last x characters from a string
Replace a string case insensitive
Replace all occurences in a string
Replace spaces in _ and all letters in uppercase
Replace without regex
Reverse the letters in a string
Reverse the letters in a string 2
Reverse the letters in a string 3
Safely combine multiple variables into a string
Search a string on the x'th occurence
Shortening a string
Sort a strings letters
Split a tekst in multiple lines
Sort the words in a string on length
Split first name and surname
Strange addition
Subtract a number from a string yields the answer as a string
Test if a character is a letter or a sign
Test if a character or word is present in a string
Test if a character or word is present in a string 2
Test if a string is an anagram
Test if a string is a palindrome
Test if a string contains numbers
Test if a text is present in another text
Test wether two strings are case insensitive equal
Use padStart to add predecesser characters
Which letter corresponds with a number
Wich place has a letter in the alphabet
77 Various Tips
alert, confirm and prompt
And can give weird outcomes
Another way to write one-line comments
Array with functions instead of swirch
Ask for a color, count the amount in an object and in the end alert the amounts entered.
Assign a default value to a variable
Clear all intervals
Clear localstorage
Convert a Boolean value to a string
Convert a variable to a Boolean value
Convert a variable name to a string
Convert an RGB value into hex
Convert character codes to a string
Delay in a foreach loop
Delay in a loop
Determine schreen width and height
Encrypt and decode (base-64)
Escape cahracters
Evaluate a string
Forget OR use switch-case
Format text in an alert
Generate a password of x characters
Generate a password of x characters 2
Generate a pseudo random number
Generate a random hex value
Get a random hex color
Get a random number within a certain range
Get a list of all variables on a page
Give multiple variables simultaneous the same value
Javascript undefined bug
Inspect what is stored in localstorage
Inspect what is stored in sessionstorage
Let your code run endlessly
Local storage clearing
Localstorage only stores strings
Local storage can pose a safety problem
Make your code looking good
Measure how long a function or piece of code runs
Measure the performance of a code block
Multiple lines in an alert
NaN is sometimes not equal to NaN
Pause in Javascript
Pause in Javascript 2
Press a single key to activate a function
Press CTRL or ALT and a key to activate a function
Prohibit part of the page to be printed
Prevent errors
Random true or false
Remove an item from localstorage
Skip a step in a loop
Speak out your texts
Stop a loop after some time
Stop running code on a condition
Store data in a file
Store large amounts of data
Swap two or more variables
Switch-Case
Switch case with comparisons
Switch case with multiple parameters
Switch case with return statements
Test if a variable exists
Test if a variable is empty
Test if the browser support touch events
Test if user is online
Test if localstorage is activated
Test if localstorage is used or empty
Test if sessionstorage is activated
Toggle a Boolean variable
Use AND as a replacement for if()
Use OR to give a variable a default value
Use OR to test if a variable is falsey
Use promp for a quick answer
What is syntactic sugar (software candy)
Where is the mouse on your screen
Where is this webpage located
Where is this webpage located 2
Which language does the user use