Good JS Cheat Sheet

The information that you find in this page will be your one stop reference in knowing JS that being used in programs. Check this JS cheat sheet to serve as your guide. Then check vectors cheat sheet.

Good Cheat Sheet Template

js cheat sheet

Element and its Description

  • var myVar = 0; = Makes variable with the provided starting value. The type is being measured dynamically.
  • stringVar = prompt(“message”) = transmits the message to the user in dialog box where it will retrieve the text given by the user as well as it will be stored in the stringVar.
  • stringVar.length = It will give back the length which will be in characters of the stringVar.
  • stringVar.toUpperCase(), stringVar.toLowerCase() = It will convert the stringVar to lowercase or uppercase
  • stringVar.substring() = It will return the specified subset of the stringVar.
  • stringVar.indexOf() = It will return the location of the substring instringVar (or -1).
  • parseInt() = It converts the string to the int.
  • parseFloat() = It converts the string to the float.
  • toString() = It converts variable to the string.
  • eval() = It will evaluate the string as the JavaScript code.
  • Math.ceil() = It will convert any digit or number to the integer through rounding up
  • Math.floor() = It will convert any digit or number to the integer by rounding down

Cheat Sheet Template: Basic I/O Commands in JS

For some JavaScript programmers, they are using commands that is shown on the table below when it comes to controlling of the dialog based output and input that will be used in web.

Element and its Description:

  • alert(“message”); = makes a popup dialog that contains “message.”
  • stringVar = prompt(“message”) = Send the message to the user in dialog box and the it will retrieve the text input coming from the user as well as to be stored it in the stringVar

how to do Underscore js cheat sheet: Conditions & Branching Code

Element and its Description:

if (condition){
 // content
 } else {
 // more content
 } // end if

Description: It will executes only the content if the condition is correct.

switch (expression)
 case: value;

Description: Compares the expression against 1 or to more values. For instance, if certain expression will be equal to the value, it will run corresponding code.

for(i = 0; i < count; i++)
 } // end for

Description: Repeats code i times.

While (condition){
 } // end while

Description: Repeats the code as long as the condition is correct.

Function fnName(paramaters) {
 } // end function

Description: Defines the function named fnName and sends it in the parameters. All code inside a function will be execute when function is called.

Adding the JS operators to condition statements: How to do a Cheat Sheet Help

Name Operator Example Notes

Equality == (x==3) Works with all variable types, including strings.

Not equal != (x != 3) True if values are not equal.

Less than < (x < 3) alphabetical or numeric comparison.

Greater than > (x > 3) alphabetical or numeric comparison.

Less than or equal to <= (x <= 3) Numeric or alphabetical comparison.

Greater than or equal to >= (x >= 3) Numeric or alphabetical comparison.

It is important to know about cheat sheet tips because it will help you. It is important that you know about the proper commands to get the exact formula or output you are looking for.

Finally, you finally have a guide with underscore js cheat sheet. Make sure that you will not forget about the information in the cheat sheet. Don’t forget to see tips about software testing cheat sheet.

Use our JS cheat sheet today!

Download as PDF

Next Post

Previous Post

© 2017 My Cheat Sheet

Theme by Anders Norén