Latest stories

JavaScript Iterate over Arrays with map

The map method is a convenient way to iterate through arrays. The map method will iterate through every element of the array and create a new array with values that have been modified by the callback function, and return it. Here’s an example usage: var oldArray = [1, 2, 3]; var timesFour =...

JavaScript Filter Arrays with filter

The filter method is used to iterate through an array and filter out elements. filter takes the current value as an argument and apply conditions. Any array element that returns true will be kept and elements that return false will be filtered out. The following code filter will array elements that...

JavaScript Concatenate Arrays

For concatenating two arrays into one we will use concat function. Say we have array1 and array2 and we want to make a new array by merging these two arrays. The code is: var array1 = [1,2,3,4,5]; var array2 = [6,7,8,9,10]; var newArray = array1.concat(array2); console.log(newArray); // returns...

Word: Hoax

hoax (hooks) A humorous or malicious deception. Ex: That person figured out Lennay was a hoax after about a month. hu·mor·ous Causing lighthearted laughter and amusement; comic. Ex: The posts range from YouTube videos and humorous political cartoons to traditional articles. light·heart·ed Amusing...

Python count group letters in a string

Say we have a string like “abaabbbccccaaac”. We want to count same group of letters in a string and display like “a1b1a2b3c4a3c1” The code is given below: a = "abaabbbccccaaac" o = "" while len(a) > 0: count = 0 i = 0 ch = a[0] while i < len(a) and a[i] == ch: count += 1 i += 1 a = a[count:]...

Python using any, all

any and all can be think of as a series of logical or and and operators. any any will return True when at-least one of the elements is True all all will return True only when all the elements are True Internal structure of any(iterable) def any(iterable): for element in iterable: if element: return...

What is First-class Function?

A programming language is said to have First-class functions when functions in that language are treated like any other variable. For example, in such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a...

Basic git use

In this tutorial we will learn the following: Create a repository on github Install git client Clone the repository on local machine Upload (push) files to github from local Download (pull) files from github to local Description: Create a repository on github: Press on the “+” button on top of...

Categories

Imran Pollob

Learn => Practice => Implement => Repeat

Get in touch