Results For Tag : tutorial
JavaScript Try Catch: A Step-By-Step Guide
JavaScript try catch blocks are error handlers. The "try" block contains the code you want to test. "catch" contains code that will run if the code in your "try" block cannot execute successfully. When developers are testing their programs, it’s…
JavaScript Ternary Operators: A Step-By-Step Guide
The JavaScript ternary operator evaluates a statement and returns one of two values. A ternary operator can be instructed to return a value if the statement evaluates to either true or false. The syntax for the ternary operator is: statement…
JavaScript String Contains: Step-By-Step Guide
You can check if a JavaScript string contains a character or phrase using the includes() method, indexOf(), or a regular expression. includes() is the most common method for checking if a string contains a letter or series of letters, and…
Python Comment: A Step-By-Step Guide
A Python comment is a line of text in a program that is not executed by the interpreter. Comments are used during debugging to identify issues and to explain code. Comments start with a hash character (#). How to Comment…
Python Try Except: A Step-By-Step Guide
The Python try...except statement catches an exception. It is used to test code for an error which is written in the "try" statement. If an error is encountered, the contents of the "except" block are run. How to Use Try…
JavaScript Onclick: A Step-By-Step Guide
The JavaScript onclick event executes a function when a user clicks a button or another web element. This method is used both inline in an HTML document and in a JavaScript document. When you are coding in JavaScript, it’s common…
Python Reverse String: A Step-By-Step Guide
You can reverse a string in Python using slicing or the reversed() method. A recursive function that reads each character in a string and reverses the entire string is another common way to reverse a string. There is no function…
JavaScript Replace(): A Step-By-Step Guide
To replace text in a JavaScript string the replace() function is used. The replace() function takes two arguments, the substring to be replaced and the new string that will take its place. Regex(p) can also be used to replace text…
JavaScript Split: A Step-By-Step Guide
The JavaScript split() method divides a string into an array of substrings. These substrings are added to a new array. split() returns the new array of substrings. When you’re programming, it’s common to see cases where you need to get…
JavaScript Splice: How to Use It
The JavaScript splice() method modifies an array. It is used to add new elements to an array or remove or change existing ones. splice() changes the array on which it is used. It does not create a new array. It’s…
Python Read File: A Step-By-Step Guide
The open() function opens a file. You must use the "r" mode to read a file. The read(), readline(), readlines() functions return the contents of a file you have opened. Python is a useful programming language to use if you…
How to Use Substring in JavaScript
The JavaScript substring() method retrieves a range of characters between two index positions. You can use substring() to retrieve characters to the end of a string by omitting an end index position. A substring is a smaller portion of a…
JavaScript Filter: A Step-By-Step Guide
The JavaScript() filter method creates an array of elements from an existing array. The filter() method accepts a callback function as an argument. This function evaluates whether an element should be added to the new list from the existing one.…
Python Input: A Step-By-Step Guide
The Python input() and raw_input() functions are used to collect user input. input() has replaced raw_input() in Python 3 and onward. Both functions return a user input as a string. Processing user input is a crucial part of programming. For…
Python Break and Continue: Step-By-Step Guide
The Python break statement stops the loop in which the statement is placed. A Python continue statement skips a single iteration in a loop. Both break and continue statements can be used in a for or a while loop. You…
Python Append to List: A Step-By-Step Guide
The append() Python method adds an item to the end of an existing list. The append() method does not create a new list. Instead, original list is changed. append() also lets you add the contents of one list to another…
Enumerate Python: Step-by-Step Guide
The Python enumerate() function adds a counter to an iterable object. The counter lets you keep track of how many iterations have occurred. This counter is stored as a separate variable. The Python programming language has several useful features that…
How to Use JavaScript Functions: A Step-By-Step Guide
JavaScript functions are custom blocks of code that can be reused. Functions allow code to be more modular and are essential to object-oriented programming. Functions can be defined through declarations or expressions. If you’re trying to learn JavaScript and looking…
Python Array: A Step-By-Step Guide
Python arrays are a data structure like lists. They contain a number of objects that can be of different data types. In addition, Python arrays can be iterated and have a number of built-in functions to handle them. Python has…
Python Queue and Deque: A Step-By-Step Guide
Python queue is a built in library that allows you to create a list that uses the FIFO rule, first in first out. Python deque uses the opposite rule, LIFO queue, or last in first out. Both operate on stacks…
JavaScript forEach Loops Made Easy
The JavaScript forEach loop is an Array method that executes a custom callback function on each item in an array. The forEach loop can only be used on Arrays, Sets, and Maps. If you’ve spent any time around a programming…
Python Map Function: A Step-By-Step Guide
The Python map() function executes a function on each item in a collection, such as a list or a set. The map() function accepts a function and an object to apply that the function will operate on as arguments. When…
Python Collections: A Step-By-Step Guide
Python has four data collection types: lists, tuples, sets, and dictionaries. The collections Python module provides additional options, including namedtuple, Counter, defaultdict, and ChainMap. Python offers four collection data types: lists, tuples, sets, and dictionaries. Each of these data types…
How to Debug in Python Without Going Crazy
You’re feeling pretty good about yourself. You’ve been learning Python and you’re finally comfortable enough with your skills to put together a full-on program. It was a lot of work, but you put the code together and wrote the app.…