Home » Programming

How To Compare Arrays in JavaScript, With Examples

Compare Arrays in JavaScript

This article will show you how to compare arrays in JavaScript and provides some ready-to-use functions to do so. We’ve already covered a bit on how to use arrays in JavaScript: Looping over Array using JavaScript forEach(), With Examples Array slice() Method in JavaScript, with Examples() Check Array Contains a Value in JavaScript, with Examples Removing an Element From an Array in JavaScript, with Examples What is an Array? An array is a type of JavaScript variable that can hold other variables, or references to … Read more

Home » Programming

JavaScript instanceof Operator – What it Does, How to Use It

JavaScript instanceof Operator

This article will explain what the JavaScript instanceof operator does and how it can be used. Examples provided. What does instanceof do? The instanceof operator returns TRUE or FALSE depending on whether a given value or variable is of a certain type or class – it checks whether a value is an instance of a given object class or type. The purpose of instanceof may seem confusing – you already have typeof, so what do you need instanceof for? typeof will simply return a string containing the name of the type or class of the variable. In contrast, instanceof will return a … Read more

Home » Programming

Refresh or Redirect a Page using PHP, With Examples

PHP Refresh Page

This article will show you how to refresh a web page in the browser using the PHP programming language. It’s sometimes necessary to set a page to reload automatically, usually at some interval, to keep the page updated with changing information. For example, you may have a scoreboard application that is displayed in a web browser on a projector and wish to have it periodically refresh to keep the displayed scores up to date with those stored. Periodic refreshing is also used to redirect to … Read more

Categories PHP

Home » Programming

Linked Lists in Python – How to Use Them, With Examples

Python Linked Lists

This article will explain in simple terms what linked lists are, why they’re useful, and how to use them in the Python programming language. Lists In Python, a list is an array of data – a simple list of values where each item has a value and a position in the list. Lists are indexed (so the positions start counting at position 0, not 1). For more information on lists in Python, check out these LinuxScrew articles: Python List ‘sort()’ Method – Sorting Lists in Python Easily … Read more

Home » Programming

Multidimensional Arrays in PHP – How To Use, With Examples

PHP Multidimensional Arrays

This article will show you how to use multidimensional arrays in the PHP programming language, explaining what they are and how to use them. What is an Array? An array is a type of PHP variable that can hold multiple values. It’s a list of values you can loop through and perform operations on each individual value. For example, you might want to perform an action on a list of files. By storing that list as an array, you can loop through the file names … Read more

Categories PHP

Home » Programming

Converting a List to a String (and Back!) in Python [Examples]

Python List to String

This article will show you how to convert lists to a string in the Python programming language. Why would you want to convert a list to a string? Most commonly, because you want to print it or because you want to store it in a database text field or a text file. Converting List to String in Python The join() string method will take a list or iterable in Python and join each element, using the given string as a separator between each element. # Define a list of strings myList … Read more

Home » Programming

JavaScript onclick() Events – Tutorial, With Examples

JavaScript onclick() Tutorial

JavaScript adds interactivity to web pages. This article shows you how to trigger JavaScript functions when an HTML element is clicked using onclick() events and attributes. Code examples included. JavaScript Events An event in JavaScript simply means that something has happened. The mouse has moved, or a key has been pressed, and JavaScript has been notified by the raising of an event. onclick Event When the user clicks on something, the onclick event is raised, allowing you to trigger some JavaScript code when an element is clicked. … Read more

Home » Programming

JavaScript vs Java – What’s the Difference Which to Use in 2021?

JavaScript vs Java

Here’s a clear article on what makes Java and JavaScript different – and some information to help you make the choice on which to learn and use for your projects in 2021. First up, it’s important to clarify that JavaScript and Java are not the same things! They just have similar names. It’s stupid, and they should have called JavaScript something else (and tried to re-badge it ECMA Script, which is also a terrible name), but the JavaScript name stuck. Now we’re all stuck with two different programming languages … Read more

Home » Programming

Python Matrix (2D Array, NumPy), With Examples

Python Matrix

This article will explain what a matrix is and how to use them in the Python Programming Language with the NumPy library. What is a Matrix In mathematics and computer programming, a matrix is a two-dimensional array of values. It is a grid of columns and rows, with each position in the grid holding one of these values. It is an array because it’s a collection of elements with multiple elements, and it’s two-dimensional because the values exist at two coordinates (i.e., rows and columns). … Read more

Home » Programming

Copy a Table in MySQL/MariaDB – How To, With Examples

Mysql MariaDB Copy Table

This article will show you the BEST way to copy a table, with or without the data in it, in MySQL and MariaDB. Copying the Table with All Data in MySql The following code will copy a table including all data using the CREATE TABLE LIKE statement: CREATE TABLE new_table_name LIKE database_name.old_table_name; INSERT new_table_name SELECT * FROM database_name.old_table_name; There are other methods, some single line, but this is probably the best and simplest one. Why did I choose this method? Because it copies the table … Read more