Deep Tech Point
first stop in your tech adventure
Home /
February 22, 2021 | Javascript

In this article, we are going to present how to clone an object in Javascript. There are actually at least four ways to copy an object and they differ from each other in a few ways. You can use:

  • the spread syntax,
  • the object rest syntax,
  • object.assign() method,
  • and the JSON.stringify() and JSON.parse() methods.

So, take a look at each and see when it’s best to use a specific method.

February 21, 2021 | Javascript

In this article, we are going to investigate what are the differences (and similarities) between JavaScript arrays and objects, and how do you know when to use objects vs arrays?

February 19, 2021 | Javascript

Maybe you have an issue with a server, which is sometimes returning either a JSON string with some useful data, and at other times server returns an error message string, which is produced by the PHP function mysql_error(). A simple solution to this problem would be to test whether this data is a JSON string or an error message.

A straightforward answer to a question on how to test if a string is JSON or not would be to use JSON.parse function isJson(str), like so:

function isJson(str) {
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}

February 17, 2021 | Javascript

Nullish coalescing operator is a logical javascript operator that was introduced in JavaScript with the launch of ES2020 aka ES11and is symbolized with double question marks (??).

The nullish coalescing operator is a logical operator that accepts two operands – one on its left-hand side and one on its right-hand side and the syntax looks like this:

LeftHandSideOperand ?? RightHandSideOperand

Let’s see where we can use it.

February 15, 2021 | Javascript

In Javascript both var and let are used to declare a variable. However, there are a few differences between javascript var vs let, so let’s take a look at them.

February 14, 2021 | Javascript

Javascript language is de-facto standard for making client-side web applications that consume different kinds of APIs. It can even be used for mobile applications thanks to wrapper frameworks such as Apache Cordova, React Native, or NativeScript. You can even use it with gaming frameworks like Cocos 2D, Unity, or many others. Almost all games published in recent few years, especially for mobile phones can also be classified as client-side applications that interact with server-side sending and receiving data such as score, in-game positions, moves, and many others to the server through an API.

But let’s take a look at a simple example of Javascript client application that consumes an API using a built-in fetch function.

February 12, 2021 | Javascript

In Javascript we have a couple of options for checking equality, so let’s take a look at them – what are similarities, and what are the differences.

February 11, 2021 | Javascript

What is null in Javascript?

In JavaScript the value null represents the intentional absence of any object value. The value null is one of JavaScript’s primitive values and is treated as falsy for boolean operations. We could compare a value null to a similar primitive value – undefined. Undefined is an unintentional absence of any object value, and this “unintentional” is the thing that differentiates null from the undefined.

February 10, 2021 | PHP

The beauty of PHP is that you can do one thing in several different ways. And, yes, this is the case with PHP arrays too – they can be merged using the + array union operator or you could use the array_merge() function. However, there is a difference between array_merge and array + array, so let’s take a look at the functions we’re are dealing with.

February 4, 2021 | PHP

This article is going to focus on the comparison operator known as Equal Operator and presented as “==” or double equal sign, and the inbuilt strcmp() function. We are going to look at the differences and similarities between these two.