10 Javascript Concepts You Need To Know For Interviews

| | | | | | | | | | | |

👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!

How to learn TypeScript

In recent years, TypeScript has become an increasingly popular language for developers.

TypeScript, created by Microsoft in 2012, is a great set of typed JavaScript that allows you to write scalable and efficient web applications. Developers often talk about how TypeScript lets you "write JavaScript the way you want". It refers to how the language gives you more control over your schedules.

According to RedMonk January 2020 Ranking of programming languages ‚Äã‚Äã, TypeScript is the seventh most used programming language by developers. This index tracks the popularity of various programs in different languages ‚Äã‚Äã/

In this guide, we discuss the best way to learn TypeScript online. We’ll give you some tips on how to master your TypeScript skills.

What is JavaScript ?

Before talking about TypeScript, let’s refresh our memories of another programming language: JavaScript.

JavaScript is a scripting language for building dynamic websites. You can add features to sites such as animated images, interactive buttons, and web page components using JavaScript. These items change when a user interacts with them.

Anytime you see a web page that doesn’t just display text, JavaScript is involved in some way.

What is TypeScript ?

TypeScript is a typed, open source super set of the JavaScript programming language. TypeScript was created by Microsoft in 2012 to make it easier for developers to build large and scalable applications. It is widely used by companies such as Slack, Asana, and Microsoft.

The TypeScript language uses the same syntax and semantics as the JavaScript language. There are some differences that make it easier to write scalable code. Therefore, you can use existing JavaScript code to start a TypeScript application and then call TypeScript code from a JavaScript application.

The TypeScript feature set supports all of the latest JavaScript features. This means that when you use TypeScript you don’t lose any other functionality that was introduced in JavaScript.

While JavaScript is a dynamic scripting language, TypeScript is a static scripting language that relies on JavaScript code. TypeScript does not replace JavaScript. It is a complementary technology used in conjunction with JavaScript, especially when you want to build highly scalable web applications.

Here are the main differences between JavaScript and TypeScript:

What is TypeScript used for ?

TypeScript is a modern web development framework. Extend JavaScript with static type definitions. These definitions simplify the description of how an object is structured, which improves code readability.

All JavaScript code can be TypeScript code. This is because TypeScript extends only to JavaScript. It does not replace paint. TypeScript code is transformed into JavaScript code during compilation.

It is not necessary for a developer to modify the entire application to support TypeScript. At any time, TypeScript can be added to a client or server side application.

Since TypeScript is based on JavaScript, any transition will result in the addition of TypeScript code rather than the removal of JavaScript code.

How long does it take to learn TypeScript ?

It takes about a month to learn the basics of TypeScript, assuming you study at least an hour a day. Expect to spend at least six months studying TypeScript before developing the skills to apply it in a professional development environment.

Since TypeScript is based on JavaScript, much of the terminology you hear will be familiar to you. This will speed up the learning process. But TypeScript is its own technology. So, there will be many concepts that you will need to learn from scratch.

The time it takes to learn TypeScript depends on the time you spend studying. If you study full time, you will be able to learn TypeScript faster than those who study only part time.

Is TypeScript hard to learn to learn ?

Learning TypeScript is a bit more difficult than learning JavaScript. This is because TypeScript extends to JavaScript, so you need to understand how JavaScript works first. But, with a little practice and time, you shouldn’t have a problem learning TypeScript.

TypeScript has many features that are not supported by JavaScript. These include decorators, access modifiers, enumerations, static typing, and interfaces. Expect to spend time learning completely new concepts that you may never have come across in web development.

Why should you learn TypeScript ?

While JavaScript is great for flexibility, in many cases it is not as great for building highly scalable web applications. As you learn TypeScript, you’ll have a whole new set of tools you can use to effectively write scalable web applications.

Many web developers learn TypeScript because the language offers static input. Static input can improve your development experience by making it easier to write readable code. For example, tools like TSLint and TSServer allow you to improve the style and efficiency of your code.

That’s not all: TypeScript is also a skill in high demand in the job market. According to the 2020 State of Hired Software Engineers Report, TypeScript is the fourth question coding language in the world. TypeScript is behind Go, Scala, and Ruby. Learning TypeScript should increase your chances of getting a good tech job.

How to learn TypeScript quickly

So you’ve decided to learn TypeScript. It is an excellent choice. But how do you quickly learn TypeScript?

To answer this question, we are going to explore the main topics that you will need to study in order to program effectively in TypeScript. Then we will discuss how to learn these topics. Let’s get started!

Develop your skills

The first step in learning TypeScript is to master the basics. all other components that make up the TypeScript language. Once you’ve learned the basics, you can continue to explore the more complicated facets of TypeScript. Let’s break down the main skills you need to know to learn TypeScript.

Learn HTML, CSS and JavaScript

Because TypeScript is based on JavaScript, before you start you will need to learn to code in HTML, CSS and JavaScript.

First of all, you need to learn the basics of HTML and CSS. These are the two programming languages ‚Äã‚Äãused respectively to determine the structure and style of a web page. Once you have mastered these technologies, you will need to learn the basics of JavaScript.

To get started, check out our guides for learning HTML and CSS:


Types are an essential component of TypeScript, hence the name of the language.

In TypeScript, types can be assigned to variables when they are declared. This allows you to write more reliable and scalable code and also improves the readability of your programs.

To work effectively with TypeScript, you need to understand the main data types used by JavaScript. Here are the main topics you should explore:

Variables and comments

Variables are used to store values ‚Äã‚Äãin TypeScript. For example, a variable can store the name or date of birth of a user.

Comments allow you to add script to your code that is not read by the browser, but can be read by developers. Comments allow you to explain how your code works.

Since TypeScript and JavaScript variables and comments work differently, you should explore these two topics in depth. Here are some topics related to variables and comments that you should explore:


TypeScript offers a number of improvements to traditional JavaSc ript functions .

In TypeScript, for example, you can declare a function as you would in JavaScript. But you can also use TypeScript types as function arguments.

There are two types of functions you should know about: function expressions and function declarations. You should also be familiar with how "this" keyword works in TypeScript, which is also derived from JavaScript.

Object oriented programming

TypeScript is an object oriented programming language, and it adds a number of new features to improve functionality object-oriented JavaScript. For example, you can create classes using a "class" keyword in TypeScript.

You should familiarize yourself with the following topics related to object-oriented programming:


One of the main features of TypeScript is the interface. Interfaces allow you to define a specific structure for a variable. You need to know what an interface can contain and how to define an interface.


Modules is a TypeScript feature that allows you to split your code into many small, reusable components. It can help you organize your project better. You should know the basic syntax that TypeScript uses to import and export forms to files.

We’ve only covered a few of the key TypeScript features you may be familiar with - there is so much more to explore! By familiarizing yourself with the concepts mentioned above, you will be on a good footing to continue exploring other TypeScript concepts.

How to learn TypeScript online

There is a huge amount of resources to help you learn TypeScript. This is a good thing - the more resources available, the more likely there is one that exactly meets your needs. However, choosing which resources to use can be daunting.

The first thing you should do before learning TypeScript is to ask yourself how you learn best.

Do you like online tutorials or do you prefer online lessons? Do you want to work on team projects or do you feel comfortable learning on your own? By considering this question beforehand, you can get a better idea of ‚Äã‚Äãwhat types of materials you should be looking for.

Online typing course

Introduction to TypeScript by Udemy

This course is designed to introduce the basics of TypeScript. You will learn how to compile, test, and run TypeScript on your computer. By the end of this course, you will have created a simple application using TypeScript.

Pluralsight TypeScript Basics

TypeScript Fundamentals explores the concepts you need to know to write a web application in TypeScript. This course covers topics such as TypeScript syntax, the code editor, typing and variables, and modules.

Understanding Udemy’s TypeScript (2020)

This course covers the basics of TypeScript and its main features. You will develop a key understanding of the utility of TypeScript and how it can be combined with other web development frameworks. This course includes 15 hours of video and 210 downloadable resources.

The Best TypeScript Tutorials

The internet is full of tutorials for learning everything you could possibly want to learn. Tutorials provide a simple guide to performing a specific task using a specific tool, in this case TypeScript. Below, we go over the best TypeScript tutorials available for beginners and advanced users, along with the best free options.

The best TypeScript tutorials for beginners

TypeScript Tutorial

Check Out Tutorial Teacher if you are new to TypeScript and want to learn more. On this site, you can learn everything from the basics to the most advanced features of the language. There are lessons on basic syntax, type annotation, variables, arrays, strings, interfaces, classes, objects, and namespaces, to name a few.

One of the features offered by the site is " Try It " Option which allows you to run and modify lines of code online and see the results. To get the most out of this tutorial, it is best to have a clear understanding of Object Oriented Programming (OOP) and a basic understanding of JavaScript.

Complete TypeScript tutorial for beginners

Learn all the important things about TypeScript in this comprehensive tutorial powered by TekTutorialsHub. Not only does it cover all the features of the language, it’s also completely free. Like the website listed above, it’s best if you have a basic idea of ‚Äã‚ÄãOOP and JavaScript code.

This tutorial will walk you through key aspects of the programming language, such as syntax and basic rules. . It also explains how to install TypeScript and configure the development environment. If you complete each tutorial, you will understand variable declarations, type annotations, type interfaces, string data types, numbers, BigInt, special and advanced types, and even TypeScript operators.

Learn TypeScript: the complete course for beginners

You can access this TypeScript course for free, even if you do not have an Educational account. However, if you’ve already used your free access for one of their trainings, you’ll need to shell out $ 34 per year to get this tutorial. This is a text-based tutorial with 114 lessons, which you can complete in about 12 hours.

Start with the basics and move on to more advanced concepts like type checking and array manipulation. You will learn fundamental concepts such as the basics of variables, generic types, and functions. There is also a programming environment where you can code and practice what you have learned.

TypeScript Tutorial

Javapoint is another great platform that

👻 Read also: what is the best laptop for engineering students?

10 Javascript Concepts You Need To Know For Interviews __del__: Questions


How can I make a time delay in Python?

5 answers

I would like to know how to put a time delay in a Python script.


Answer #1

import time
time.sleep(5)   # Delays for 5 seconds. You can also use a float value.

Here is another example where something is run approximately once a minute:

import time
while True:
    print("This prints once a minute.")
    time.sleep(60) # Delay for 1 minute (60 seconds).


Answer #2

You can use the sleep() function in the time module. It can take a float argument for sub-second resolution.

from time import sleep
sleep(0.1) # Time in seconds

10 Javascript Concepts You Need To Know For Interviews __del__: Questions


How to delete a file or folder in Python?

5 answers

How do I delete a file or folder in Python?


Answer #1

Path objects from the Python 3.4+ pathlib module also expose these instance methods:


How do I list all files of a directory?

5 answers

How can I list all files of a directory in Python and add them to a list?


Answer #1

os.listdir() will get you everything that"s in a directory - files and directories.

If you want just files, you could either filter this down using os.path:

from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]

or you could use os.walk() which will yield two lists for each directory it visits - splitting into files and dirs for you. If you only want the top directory you can break the first time it yields

from os import walk

f = []
for (dirpath, dirnames, filenames) in walk(mypath):

or, shorter:

from os import walk

filenames = next(walk(mypath), (None, None, []))[2]  # [] if no file


Answer #2

I prefer using the glob module, as it does pattern matching and expansion.

import glob

It does pattern matching intuitively

import glob
# All files ending with .txt
# All files ending with .txt with depth of 2 folder

It will return a list with the queried files:

["/home/adam/file1.txt", "/home/adam/file2.txt", .... ]


Answer #3

os.listdir() - list in the current directory

With listdir in os module you get the files and the folders in the current dir

 import os
 arr = os.listdir()
 >>> ["$RECYCLE.BIN", "work.txt", "3ebooks.txt", "documents"]

Looking in a directory

arr = os.listdir("c:\files")

glob from glob

with glob you can specify a type of file to list like this

import glob

txtfiles = []
for file in glob.glob("*.txt"):

glob in a list comprehension

mylist = [f for f in glob.glob("*.txt")]

get the full path of only files in the current directory

import os
from os import listdir
from os.path import isfile, join

cwd = os.getcwd()
onlyfiles = [os.path.join(cwd, f) for f in os.listdir(cwd) if 
os.path.isfile(os.path.join(cwd, f))]

["G:\getfilesname\getfilesname.py", "G:\getfilesname\example.txt"]

Getting the full path name with os.path.abspath

You get the full path in return

 import os
 files_path = [os.path.abspath(x) for x in os.listdir()]
 ["F:\documentiapplications.txt", "F:\documenticollections.txt"]

Walk: going through sub directories

os.walk returns the root, the directories list and the files list, that is why I unpacked them in r, d, f in the for loop; it, then, looks for other files and directories in the subfolders of the root and so on until there are no subfolders.

import os

# Getting the current work directory (cwd)
thisdir = os.getcwd()

# r=root, d=directories, f = files
for r, d, f in os.walk(thisdir):
    for file in f:
        if file.endswith(".docx"):
            print(os.path.join(r, file))

os.listdir(): get files in the current directory (Python 2)

In Python 2, if you want the list of the files in the current directory, you have to give the argument as "." or os.getcwd() in the os.listdir method.

 import os
 arr = os.listdir(".")
 >>> ["$RECYCLE.BIN", "work.txt", "3ebooks.txt", "documents"]

To go up in the directory tree

# Method 1
x = os.listdir("..")

# Method 2
x= os.listdir("/")

Get files: os.listdir() in a particular directory (Python 2 and 3)

 import os
 arr = os.listdir("F:\python")
 >>> ["$RECYCLE.BIN", "work.txt", "3ebooks.txt", "documents"]

Get files of a particular subdirectory with os.listdir()

import os

x = os.listdir("./content")

os.walk(".") - current directory

 import os
 arr = next(os.walk("."))[2]
 >>> ["5bs_Turismo1.pdf", "5bs_Turismo1.pptx", "esperienza.txt"]

next(os.walk(".")) and os.path.join("dir", "file")

 import os
 arr = []
 for d,r,f in next(os.walk("F:\_python")):
     for file in f:

 for f in arr:

>>> F:\_python\dict_class.py
>>> F:\_python\programmi.txt

next(os.walk("F:\") - get the full path - list comprehension

 [os.path.join(r,file) for r,d,f in next(os.walk("F:\_python")) for file in f]
 >>> ["F:\_python\dict_class.py", "F:\_python\programmi.txt"]

os.walk - get full path - all files in sub dirs**

x = [os.path.join(r,file) for r,d,f in os.walk("F:\_python") for file in f]

>>> ["F:\_python\dict.py", "F:\_python\progr.txt", "F:\_python\readl.py"]

os.listdir() - get only txt files

 arr_txt = [x for x in os.listdir() if x.endswith(".txt")]
 >>> ["work.txt", "3ebooks.txt"]

Using glob to get the full path of the files

If I should need the absolute path of the files:

from path import path
from glob import glob
x = [path(f).abspath() for f in glob("F:\*.txt")]
for f in x:

>>> F:acquistionline.txt
>>> F:acquisti_2018.txt
>>> F:ootstrap_jquery_ecc.txt

Using os.path.isfile to avoid directories in the list

import os.path
listOfFiles = [f for f in os.listdir() if os.path.isfile(f)]

>>> ["a simple game.py", "data.txt", "decorator.py"]

Using pathlib from Python 3.4

import pathlib

flist = []
for p in pathlib.Path(".").iterdir():
    if p.is_file():

 >>> error.PNG
 >>> exemaker.bat
 >>> guiprova.mp3
 >>> setup.py
 >>> speak_gui2.py
 >>> thumb.PNG

With list comprehension:

flist = [p for p in pathlib.Path(".").iterdir() if p.is_file()]

Alternatively, use pathlib.Path() instead of pathlib.Path(".")

Use glob method in pathlib.Path()

import pathlib

py = pathlib.Path().glob("*.py")
for file in py:

>>> stack_overflow_list.py
>>> stack_overflow_list_tkinter.py

Get all and only files with os.walk

import os
x = [i[2] for i in os.walk(".")]
for t in x:
    for f in t:

>>> ["append_to_list.py", "data.txt", "data1.txt", "data2.txt", "data_180617", "os_walk.py", "READ2.py", "read_data.py", "somma_defaltdic.py", "substitute_words.py", "sum_data.py", "data.txt", "data1.txt", "data_180617"]

Get only files with next and walk in a directory

 import os
 x = next(os.walk("F://python"))[2]
 >>> ["calculator.bat","calculator.py"]

Get only directories with next and walk in a directory

 import os
 next(os.walk("F://python"))[1] # for the current dir use (".")
 >>> ["python3","others"]

Get all the subdir names with walk

for r,d,f in os.walk("F:\_python"):
    for dirs in d:

>>> .vscode
>>> pyexcel
>>> pyschool.py
>>> subtitles
>>> _metaprogramming
>>> .ipynb_checkpoints

os.scandir() from Python 3.5 and greater

import os
x = [f.name for f in os.scandir() if f.is_file()]

>>> ["calculator.bat","calculator.py"]

# Another example with scandir (a little variation from docs.python.org)
# This one is more efficient than os.listdir.
# In this case, it shows the files only in the current directory
# where the script is executed.

import os
with os.scandir() as i:
    for entry in i:
        if entry.is_file():

>>> ebookmaker.py
>>> error.PNG
>>> exemaker.bat
>>> guiprova.mp3
>>> setup.py
>>> speakgui4.py
>>> speak_gui2.py
>>> speak_gui3.py
>>> thumb.PNG


Ex. 1: How many files are there in the subdirectories?

In this example, we look for the number of files that are included in all the directory and its subdirectories.

import os

def count(dir, counter=0):
    "returns number of files in dir and subdirs"
    for pack in os.walk(dir):
        for f in pack[2]:
            counter += 1
    return dir + " : " + str(counter) + "files"


>>> "F:\python" : 12057 files"

Ex.2: How to copy all files from a directory to another?

A script to make order in your computer finding all files of a type (default: pptx) and copying them in a new folder.

import os
import shutil
from path import path

destination = "F:\file_copied"
# os.makedirs(destination)

def copyfile(dir, filetype="pptx", counter=0):
    "Searches for pptx (or other - pptx is the default) files and copies them"
    for pack in os.walk(dir):
        for f in pack[2]:
            if f.endswith(filetype):
                fullpath = pack[0] + "\" + f
                shutil.copy(fullpath, destination)
                counter += 1
    if counter > 0:
        print("-" * 30)
        print("	==> Found in: `" + dir + "` : " + str(counter) + " files

for dir in os.listdir():
    "searches for folders that starts with `_`"
    if dir[0] == "_":
        # copyfile(dir, filetype="pdf")
        copyfile(dir, filetype="txt")

>>> _compiti18Compito Contabilità 1conti.txt
>>> _compiti18Compito Contabilità 1modula4.txt
>>> _compiti18Compito Contabilità 1moduloa4.txt
>>> ------------------------
>>> ==> Found in: `_compiti18` : 3 files

Ex. 3: How to get all the files in a txt file

In case you want to create a txt file with all the file names:

import os
mylist = ""
with open("filelist.txt", "w", encoding="utf-8") as file:
    for eachfile in os.listdir():
        mylist += eachfile + "

Example: txt with all the files of an hard drive

We are going to save a txt file with all the files in your directory.
We will use the function walk()

import os

# see all the methods of os
# print(*dir(os), sep=", ")
listafile = []
percorso = []
with open("lista_file.txt", "w", encoding="utf-8") as testo:
    for root, dirs, files in os.walk("D:\"):
        for file in files:
            percorso.append(root + "\" + file)
            testo.write(file + "
print("N. of files", len(listafile))
with open("lista_file_ordinata.txt", "w", encoding="utf-8") as testo_ordinato:
    for file in listafile:
        testo_ordinato.write(file + "

with open("percorso.txt", "w", encoding="utf-8") as file_percorso:
    for file in percorso:
        file_percorso.write(file + "


All the file of C: in one text file

This is a shorter version of the previous code. Change the folder where to start finding the files if you need to start from another position. This code generate a 50 mb on text file on my computer with something less then 500.000 lines with files with the complete path.

import os

with open("file.txt", "w", encoding="utf-8") as filewrite:
    for r, d, f in os.walk("C:\"):
        for file in f:
            filewrite.write(f"{r + file}

How to write a file with all paths in a folder of a type

With this function you can create a txt file that will have the name of a type of file that you look for (ex. pngfile.txt) with all the full path of all the files of that type. It can be useful sometimes, I think.

import os

def searchfiles(extension=".ttf", folder="H:\"):
    "Create a txt file with all the file of a type"
    with open(extension[1:] + "file.txt", "w", encoding="utf-8") as filewrite:
        for r, d, f in os.walk(folder):
            for file in f:
                if file.endswith(extension):
                    filewrite.write(f"{r + file}

# looking for png file (fonts) in the hard disk H:
searchfiles(".png", "H:\")

>>> H:4bs_18Dolphins5.png
>>> H:4bs_18Dolphins6.png
>>> H:4bs_18Dolphins7.png
>>> H:5_18marketing htmlassetsimageslogo2.png
>>> H:7z001.png
>>> H:7z002.png

(New) Find all files and open them with tkinter GUI

I just wanted to add in this 2019 a little app to search for all files in a dir and be able to open them by doubleclicking on the name of the file in the list. enter image description here

import tkinter as tk
import os

def searchfiles(extension=".txt", folder="H:\"):
    "insert all files in the listbox"
    for r, d, f in os.walk(folder):
        for file in f:
            if file.endswith(extension):
                lb.insert(0, r + "\" + file)

def open_file():

root = tk.Tk()
bt = tk.Button(root, text="Search", command=lambda:searchfiles(".png", "H:\"))
lb = tk.Listbox(root)
lb.pack(fill="both", expand=1)
lb.bind("<Double-Button>", lambda x: open_file())

We hope this article has helped you to resolve the problem. Apart from 10 Javascript Concepts You Need To Know For Interviews, check other __del__-related topics.

Want to excel in Python? See our review of the best Python online courses 2022. If you are interested in Data Science, check also how to learn programming in R.

By the way, this material is also available in other languages:

Walter Gonzalez

Massachussetts | 2022-12-01

Simply put and clear. Thank you for sharing. 10 Javascript Concepts You Need To Know For Interviews and other issues with __del__ was always my weak point 😁. Checked yesterday, it works!

Anna Chamberlet

Prague | 2022-12-01

Thanks for explaining! I was stuck with 10 Javascript Concepts You Need To Know For Interviews for some hours, finally got it done 🤗. I am just not quite sure it is the best method

Dmitry Robinson

Shanghai | 2022-12-01

I was preparing for my coding interview, thanks for clarifying this - 10 Javascript Concepts You Need To Know For Interviews in Python is not the simplest one. Will use it in my bachelor thesis


Learn programming in R: courses


Best Python online courses for 2022


Best laptop for Fortnite


Best laptop for Excel


Best laptop for Solidworks


Best laptop for Roblox


Best computer for crypto mining


Best laptop for Sims 4


Latest questions


Common xlabel/ylabel for matplotlib subplots

12 answers


How to specify multiple return types using type-hints

12 answers


Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers


Flake8: Ignore specific warning for entire file

12 answers


glob exclude pattern

12 answers


How to avoid HTTP error 429 (Too Many Requests) python

12 answers


Python CSV error: line contains NULL byte

12 answers


csv.Error: iterator should return strings, not bytes

12 answers



Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python


How to specify multiple return types using type-hints


Printing words vertically in Python


Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries


Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically