Reza Baharvand's Profile picture

Hey, I'm Reza Baharvand

I'm a developer, writer, creator. I lead a team of developers at SERP Co.I work with Reactjs, Nextjs, MongoDB, Nodejs, Expressjs.Jamstack is my JAM! and teaching about what I know keeps me rolling.


Recent Posts

Image for Coin Flip Simulator With Javascript And CSS Animations

Coin Flip Simulator With Javascript And CSS Animations

In this tutorial, you will learn to build a small app to toss a coin using HTML, CSS, and Javascript. The possible outcomes after flipping a coin are either "Head" or "tail". The probability of getting head or tail is 50%.

Image for Use Math.PI To Calculate Area And Circumference Of A Circle

Use Math.PI To Calculate Area And Circumference Of A Circle

The "Math.PI" property returns the PI "π" constant, approximately equal to 3.14159. For example, you can calculate the circumference and surface area of a circle using "Math.PI".

Image for Check If A Function Exists Before Calling With The typeof Operator

Check If A Function Exists Before Calling With The typeof Operator

If you are sharing scripts from different modules or you have a large codebase, you can use the `typeof` operator to check if a function exists.

Image for Create A Toggle Button In Javascript To Manipulate The DOM With The toggle() Method

Create A Toggle Button In Javascript To Manipulate The DOM With The toggle() Method

The "toggle()" is a method of the "DOMTokenList". It removes something like a "class" name from the list, and returns "false". If the "class" name does not exist, it will add it to the list and return "true".

Image for Understand The Comparison Operators In Javascript And Write Logic Like A Pro

Understand The Comparison Operators In Javascript And Write Logic Like A Pro

A comparison operator compares two values with each other, and returns a logical value such as "true" or "false". The operands can be "number", "string", "logical", or "object" values.

Image for Using The Javascript fillRect() Method To Create An Interactive Keyboard Controlled Rectangle Inside A Canvas

Using The Javascript fillRect() Method To Create An Interactive Keyboard Controlled Rectangle Inside A Canvas

The fillRect() method renders 2d context on HTML "canvas" element. You can create simple or complex shapes by defining ( x, y, width, height) on the canvas.

Image for Using The Math.ceil() Function In Javascript To Round a Number Up

Using The Math.ceil() Function In Javascript To Round a Number Up

To round a number up in Javascript, you can use the Math.ceil() function.

Image for Math.floor() Function in Javascript, Uses, Limitations, Type Coercion

Math.floor() Function in Javascript, Uses, Limitations, Type Coercion

The Math.floot() function Rounds a number down to its closest integer, for example, Math.floor(5.99) returns 5.

Image for Truncate a String In Javascript With The slice(), substr() And substring() Methods

Truncate a String In Javascript With The slice(), substr() And substring() Methods

You can shorten a string and limit the character length of a sentence using the slice(), substr() And substring() methods.

Image for Flattening Nested Arrays In Javascript With flat() Method

Flattening Nested Arrays In Javascript With flat() Method

Learn how to flatten nested arrays with all the elements concatinated using the flat() method.