In this tutorial, we are going to see the Golang program to find the perimeter of a Circle. Perimeter is the total length of the boundary of any closed figure. Formula Perimeter of Circle - 2 * 22 / 7 * r r - radius of a Circle For example, the radius of a Circle is 10 cm so the perimeter of a Circle is − perimeter = 2 * 22 / 7 * 10 = 62.8571428 Finding the perimeter of a circle within the function Algorithm Step 1 − Declaring the variables for ... Read More
In this tutorial, we are going to see the Golang program to find the Area of a Trapezium. The area is the total space covered by any closed figure. Formula Area of Trapezium - ½ * (b1 + b2) * h b1 - length of one parallel side of a Trapezium b2 - length of another parallel side of a Trapezium h - the distance between the parallel sides of a Trapezium. For example, the length of one parallel side of a Trapezium is 10 cm and the other parallel side is 8 cm, and the distance between ... Read More
In this tutorial, we are going to see the Golang program to find the Area of a Parallelogram. The area is the total space covered by any closed figure. Formula Area of the Parallelogram - base * height b - length of the base of a Parallelogram h - length of the height of a Parallelogram For example, the length of the base of a Parallelogram is 6 cm and the length of the height of the parallelogram is 4 cm so the Area of a Parallelogram is − b = 6 cm h = 4 cm Area ... Read More
In this tutorial, we are going to see the Golang program to find the Area of a Square. The area is the total space covered by any closed figure. Formula Area of Square - (length of a side) * (length of a side) s - length of a side of a Square For example, the length of a side of a Square is 10 cm so the Area of a Square is − Area = 10 * 10 = 100 cm^2 Finding the Area of a Square within the function Algorithm Step ... Read More
In this tutorial, we are going to see how to find the number of vowels and consonants in a sentence in Golang. If any character lies under the set {a, e, i, o , u} then that character is a vowel. Any character that does not lie in the above set is a consonant. Explanation Suppose we have a sentence “India have twenty eight states and eight union territories”. In this sentence, the characters which are bold are the vowels. So, the total vowels are 21 and consonants are 29. Finding the count of vowels and consonants within the function ... Read More
In this tutorial, we are going to see how to find the sum of Natural Numbers in Golang. To do that we have two ways one using the formula itself and the other is to use a for loop we will explore both ways in this tutorial. Formula Sum = ( N * ( N + 1))/2 N = The value of the natural number till which you want to find the sum. Explanation Let's find the sum of the first 6 natural numbers using the above formula. Sum of first 6 natural numbers = 1 + 2 + ... Read More
In JavaScript, window.onload and document.ready() are the methods used when the page is being loaded. Window.onload The window.onload method gets executed after the entire web page is loaded. This includes all the elements related with DOM like the head tag, tittle tag and all the other tags including the style sheets, images and videos. The onload method is used by passing a function to it. The called function will be executed after the object is loaded. Syntax This is the syntax of onload method − Window.onload = function() Window.onload = (event) => {} //arrow function Example 1 This example ... Read More
The Lodash library is in JavaScript, which works on the top of ‘_.js’. It can be used while working with arrays, strings, objects, numbers, etc. The assign() method This function is used to copy the original object into a new object. The difference in this and the spread operator is when nested objects are present and if assign() is used to copy the object, then the nested object will not change and the other variables of the object can be changed. There are two parameters to the assign() function. The first parameter is curly braces {} which is used to ... Read More
In JavaScript, objects are the collection of a key value pairs. The properties of the object are the keys and is denoted with a string. The value of the key is the value of the property of the given object. In JavaScript, the objects can be copied to other by many ways in which some of them are − Using spread operator(…) The spread operator in JavaScript is used to copy the values of the original given object to a new object. This operator is represented by three dots(…). Example 1 This example demonstrates how spread operator is used to ... Read More
The Stack property in JavaScript is used to store and keep track of the errors and saves the information such as the type of the error, where the error is raised and the reason of the error. The path of the origin of the error is also stored in the stacks in JavaScript. Stack is the error class property in JavaScript, which is also used to store the functions that are called, the order of the functions called too. The format of the error shown is as first, in the first line the type of the error will be displayed ... Read More