"Programming Basics with JavaScript" is the official book that introduces readers to writing programming code at a beginner's level (basic coding skills), working with the development environment (IDE), using variables and data, operators and expressions, working with the console (reading input data and printing output), usage of conditional statements (if, if-else, switch-case), loops (for, while, do-while) and working with functions (declaring and calling functions, passing parameters, and returning values). The book uses JavaScript programming language and Visual Studio Code development environment. The covered training material provides basic preparation for a deeper study of programming and prepares readers for the entrance exam in SoftUni.

This book only gives you the first steps to programming. It covers very basic skills that you must develop for years, to reach a high enough level and start working as a programmer.

The book is also used as an unofficial textbook for school-level programming courses in the high schools, studying professions like "Programmer", "Application Programmer" and "System Programmer", as well as an additional teaching tool in the initial programming courses at the secondary schools, mathematical and professional high schools., and specialty "informatics and IT".

Who is This Book Intended for?

This book is suitable for complete beginners in programming, who want to try what programming is and learn the main constructions for writing programming code that is used in software development, regardless of programming languages and technologies used. The book provides a solid basis of practical skills that are used for further study in programming and software development.

Why Did We Choose The JavaScript Language?

For this book, we chose JavaScript, because it is a modern language for high-level programming and at the same time it is easy to learn and suitable for beginners. As a use JavaScript is widespread, with a well-developed ecosystem, numerous libraries, and technological frameworks, and therefore gives many prospects for development. JavaScript combines the paradigms of procedural, functional, and object-oriented programming in a modern way with easy-to-use syntax. In the book, we'll use the JavaScript language and the Visual Studio Code development environment, which is available for free from Microsoft.

As we will explain later, the programming language with which we start is not essential, but we still need to use some programming language, and in this book, we have chosen JavaScript. The book can also be found translated in other programming languages such as Java and C# (see

The Book in Other Programming Languages: Java, C#, C++, Python

This book is available in several versions in different programming languages:

If you prefer a different language, choose from the list above.

Programming is Learned by a Lot of Writing, Not Reading!

If anyone thinks they're going to read a book and learn to program without writing a code and solve tasks hard, they're delusional. Programming is learned with practice, with writing code every day and solving hundreds, even thousands of tasks, seriously and with perseverance, for years.

You need to solve a lot of problems, to make mistakes, to fix them, search for solutions and information on the Internet, to try, to experiment, to find better solutions, get used to the code, syntax, programming language, development environment, error search and debugging of non-working code, task reasoning, algorithmic thinking, breaking down problems in steps and implementing every step, gaining experience and lifting your skills every day, because learning to write code is just the first step towards the profession of a software engineer. You have a lot to learn!

We advise the reader, as a minimum, to try all the examples from the book, to play with them, to change and test them. Even more important than the examples are the exercises because they develop the practical skills of the developer.

Solve all the tasks in the book, because programming is learned by practice! The tasks after each topic are carefully selected to cover in-depth the covered learning material. The purpose of solving all tasks from all the topics covered is to give complete writing skills to a program code at the beginners level (as is the purpose of this book).

Solve all the exercises in the book. Otherwise, you won't learn anything! Programming is learned by writing a lot of code and solving thousands of problems!

About Software University(SoftUni)

The Software University (SoftUni) is the largest training center for software engineers in South-Eastern Europe. Tens of thousands of students pass through the university every year. SoftUni was founded in 2014 as a continuation of the hard work of Dr. Svetlin Nakov in training skillful software engineering professionals by a practical, contemporary, and high-quality education that combines fundamental knowledge with modern software technologies and a lot of practice.

The Software University provides quality education, occupation, work, and the opportunity to acquire a bachelor's degree for programmers, software engineers, and IT professionals. SoftUni builds an extremely successful lasting relationship between education and industry, collaborating with hundreds of software companies, providing work and internships to its students, providing quality specialists for the software industry, and directly meeting the needs of employers through the learning process.

Judge The Exercise Verification System

The SoftUni Judge system ( is an automated system on the Internet that checks solutions to programming problems through a series of tests. Real-time problem transmission and verification: you send a solution and in seconds you get an answer if it's true. Each successful test gives the points provided for it. With a correct solution, you get all the points for the problem. With a partially correct solution, you get some of the points for the problem. With a completely wrong decision, you get 0 points.

All problem in this book are available for testing in the SoftUni Judge system and we strongly recommend that you test them once you have decided to know if you are missing something and whether your solution is working properly, as required by the problem.

Note also some features of the SoftUni Judge system:

  • For each problem the Judge system keeps the highest achieved result. If you upload a solution with the wrong code or a weaker result than your previous one sent, the system won't take points away from you.
  • The output results of your program are compared by the system strictly with the expected result. Any redundant symbol missing a comma or space may result in 0 points of the relevant test. The output that the Judge system expects is described in the condition of each problem and nothing more should be added to it.

Example: If a number is required to be printed in the output (e.g. 25), do not display descriptive messages such as The result is: 25, but print exactly what is required, i.e. only the number.

The SoftUni Judge system is available at any time from its website:

  • Use of the system is free of charge.

We are convinced that after a few problems are sent, you will like to receive instant feedback on whether the solution you wrote is true, and the judge system will become your favorite assistant when learning to program.

How do you become a programmer?

Dear readers, many of you must have the ambition to become programmers, make a living with software development, or work in the IT sector. That is why we have prepared for you a short guide "How to become a programmer" to navigate you on the steps to this much-desired profession.

A programmer (at the level of starting work in a software company) gets up for at least 1-2 years of learning and writing code every day, solving several thousand programming problems, developing several practical projects, and gaining a lot of experience with code writing and software development. It's not for a month or two! The profession of software engineering requires a large amount of knowledge, covered with many, many practices.

There are 4 main skill groups that all programmers must have. Most of these skills are sustainable over time and are not significantly affected by the development of specific technologies (which change constantly). These are the skills that every good programmer has and which every rookie should aspire to:

  • code writing (20%)
  • algorithmic thinking (30%)
  • fundamental knowledge of the profession (25%)
  • languages and development technologies (25%)

Skill # 1 - Coding (20%)

Learning how to write code forms about 20% of the minimum skills required for a programmer to start work in a software company. The ability to code includes the following components:

  • work with variables, conditionals, loops
  • functions, methods, classes, and objects
  • work with data: arrays, hash tables, strings

The ability to code can be mastered in a few months of hard learning and solving practical problems by writing code every day. This book covers only the first point of the coding skill: working with variables, conditionals, and loops. The rest remains to be learned in subsequent training, courses, and books.

The book give only the beginning of a long-term and serious study, on the path of professional programming. If you do not master the material from this book to perfection, you will not be able to become a programmer. You will lack programming fundamentals and it will become increasingly difficult for you to move forward. Therefore pay enough attention to the basics of programming: solve problems well and write a lot of code for months until you learn to easily solve all the problems in this book. Then move on.

We pay special attention to the fact that programming language doesn't have significant relevance for one's coding skill. You can either code or not. If you can code in C#, then you'll easily switch to Java, C++, or any other language. That's why coding skills are heavily studied in the software engineering courses at SoftUni. These are the skills that each programming book for beginners starts with, including this one.

Skill # 2 - Algorithmic Thinking (30%)

Algorithmic (logical, engineering, mathematical, abstract) thinking forms about 30% of the minimum skills for a start in the profession. Algorithmic thinking is the ability to break a task into a logical sequence of steps (algorithm) and to find a solution for each step, then to put them together in a working solution for the initial task. This is the most important skill that the programmer has.

How to build algorithmic thinking?

  • Algorithms for thinking are developed by reviewing many (1000+) programming tasks, using the most diverse of them. This is the recipe: reducing thousands of practical tasks, inventing an algorithm for them, and executing the algorithm, along with debugging errors along the way.
  • Physics, mathematics, and/or similar sciences help, but they are not restraining! People with engineering and technical inclinations usually learn to think logically easily, because they already have the skills for solving problems, although not algorithmic.
  • The ability to solve programming tasks (which requires algorithmic thinking) is extremely important for programmers. Many companies require only this skill in job interviews.

This book develops a beginner's level initial level of algorithmic thinking, but it is not enough to make a good programmer. To become proficient in the professions, you will need to add logical thinking skills and improve tasks outside this book, such as working with data structures (arrays, lists, matrices, hash tables, tree structures) and basic algorithms (search, sorting, tree structures, recursion, etc.).

As you may guess, the programing language does not matter for the development of algorithmic thinking. To think logically is universal, even if it's not related only to programming. Precisely for the well-developed logical thinking, it is considered that developers are quite smart and that a simple-minded person could not be a developer.

Skill #3 – Fundamental Knowledge of The Profession (25%)

Fundamental knowledge and skills for programming, software development, software engineering and computer science form about 25% of the developer's minimum start-up skills. Here are the most important of this knowledge and skills:

  • basic mathematical concepts related to programming: coordinate systems, vectors and matrices, discrete and indiscreet mathematical functions, end machines and state machines, concepts of combination and statistics, algorithm complexity, mathematical modeling, and others.
  • skills to program - code writing, data work, use of conditional structures and loops, work with arrays, lists and associative arrays, strings, and word processing, working with streams and files, using program interfaces (APIs), working with a debugger, and others.
  • data structures and algorithms - lists, trees, hash tables, columns, search, sorting, recursive, tree crawling, etc.
  • object-oriented programming (OOP) – working with classes, objects, inheritance, polymorphism, abstraction, interfaces, data encapsulation, exception management, design templates.
  • functional programming (PH) - working with lambda functions, high ordered functions, functions that return a function as a result, closing a state in a function (closure), and more.
  • databases - relational and non-relational databases, database modeling (tables and links between them), SQL query language, object-relational data access (ORM) technologies, transactionality, and transaction management.
  • network programming - network protocols, network communication, TCP/IP, concepts, tools, and technologies from computer networks.
  • client-server interaction, communication between systems, back-end technologies, front-end technologies, MVC architectures.
  • back-end development technologies - web server architecture, HTTP protocol, MVC architecture, REST architecture, web development frameworks, templating engines.
  • web front-end technologies (client development) - HTML, CSS, JS, HTTP, DOM, AJAX, back-end communication, REST API call, front-end frameworks, basic design and UX (user experience) concepts.
  • mobile technologies - mobile applications, Android and iOS development, mobile user interface (UI), server logic call.
  • built-in systems - microcontrollers, digital and analog input and output control, sensor access, peripheral control.
  • operating systems - work with operating systems (Linux, Windows, etc.), installation, configuration and basic system administration, process handling, memory, file system, users, multitasking, virtualization, and containers.
  • parallel programming and asynchronousness - thread management, asynchronous tasks, promises, common resources, and access synchronization.
  • software engineering - source control systems, development management, task planning and management, software development methodologies, software requirements and prototypes, software design, software architectures, software documentation.
  • software testing - unit testing, test-driven development, QA engineering, error reporting and error trackers, test automation, building processes, and continuous integration.

We must also make it clear this time that the programming language is irrelevant to the uptake of all these skills. They accumulate slowly, over many years of practice in the profession. Some knowledge is fundamental and can be learned theoretically, but it takes years of practice to fully understand them and realize them in depth.

Only initial knowledge in the areas listed above is usually sufficient to start working as a programmer, and the deepening takes place in the workplace according to the technologies and development tools used in the respective company and team.

Skill #4 - Programming Languages and Software Technologies (25%)

Programming languages and software development technologies form about 25% of the developer's minimum skills. They are the most voluminous to learn, but they change most quickly over time. If we look at job advertisements from the software industry, there are often all sorts of words mentioned (such as those listed below), but in fact, the ads tacitly imply the first three skills: to code, to think algorithmically, and to master the foundation of computer science and software engineering.

For these purely technological skills, a programming language is already relevant.

  • Note: only for this 25% of the profession does programming language matter!
  • For the remaining 75% of skills, language does not matter and these skills are time-resilient and portable between different languages and technologies.

Here are some commonly used software development stacks sought by software companies (up-to-date as of January 2018):

  • JavaScript (JS) + CMO + PH + databases + MongoDB or MySQL + HTTP + web programming + HTML + CSS + DOM + jQuery + Node.js + Express + Angular or React
  • C# + CMO + P + classes from .NET + DATABASE SQL Server + Entity Framework (EF) + ASP.NET MVC + HTTP + HTML + CSS + JS + DOM + jQuéry
  • Java + Java API classes + CMO + AP + databases + MySQL + HTTP + web programming + HTML + CSS + JS + DOM + jQuery + JSP/Servlets + Spring MVC or Java EE / JSF
  • PHP + CMO + databases + MySQL + HTTP + web programming + HTML + CSS + JS + DOM + jQuery + Laravel / Symfony / other MVC framework for PHP
  • Python + CMO + PH + databases + MongoDB or MySQL + HTTP + web programming + HTML + CSS + JS + DOM + jQuery + Django
  • C++ + CMO + STL + Boost + native development + databases + HTTP + other languages
  • Swift + MacOS + iOS + Cocoa + Cocoa Touch + XCode + HTTP + REST + other languages

If the words listed above seem scary and incomprehensible to you, then you are quite at the beginning of your career and have more years to learn until you reach the profession of a software engineer. Don't worry, every programmer goes through one or more technological stacks and has to study a set of interconnected technologies, but at the heart of it all is the ability to write programming logic (coding) that develops in this book, and the ability to think algorithmically (to solve programming tasks). You can not do without them!

Programming Language Doesn't Matter!

As already made clear, the difference between programming languages, and more precisely between the skills of programmers in different languages and technologies, is in about 10-20% of skills.

  • All programmers have about 80-90% of the same skills, which do not depend on language! These are the skills to program and develop software, and they are very similar in different programming languages and development technologies.
  • The more languages and technologies you speak, the faster you will learn new languages and the less you will feel a difference between them.

Indeed, the programming language is almost irrelevant, you just need to learn to program, and this starts with coding (this book), continues in the more complex concepts of programming (such as data structures, algorithms, OOP, and PH), and involves the uptake of fundamental knowledge and skills for software development, software engineering, and computer science.

Only finally, when you pinch specific technologies in a software project, will you need a specific programming language, knowledge of specific program libraries (APIs), frameworks, and software technologies (front-end UI technologies, back-end technologies, ORM technologies, etc.). Relax, you will learn them, all programmers learn them, but first, they learn the foundation: to program and to do it well.

This book uses the JavaScript language, but it is not essential and can be replaced by Java, C#, Python, PHP, C++, Swift, Go, Kotlin, or any other language. To master the profession of "software developer" it is necessary to learn to code (20%), learn to think algorithmically and solve problems (30%), have a fundamental knowledge of programming and computer science (25%) and know a specific programming language and the technologies around it (25%). Be patient, for a year or two, all this can be mastered at a good starting level, as long as you are serious and diligent.

The Book That Helps Teachers

If you are a teacher of programming, informatics, or information technology or want to teach programming, this book gives you more than a well-structured learning material with many examples and tasks. Free of charge with the book you receive quality educational content for teaching in school, in the Bulgarian language, by the school requirements:

  • Educational presentations (PowerPoint slides) for each learning topic tailored to 45-minute hours in schools – free of charge.
  • Well-designed tasks for class and homework, with detailed conditions and sample entrance and exit – free of charge.
  • An automated task and homework verification system (Online Judge System) to be used by students, also free of charge.
  • Video lessons with methodological instructions from the free course for programming teachers, which is held regularly by the SoftUni Foundation.

The History Behind This Book

The main engine and project manager for the creation of the current free programming book for beginners with open source is Svetlin Nakov, PhD.

In the beginning, these chapters had a wider reach and included more theory, but in 2016 Svetlin Nakov, PhD completely revised them, renovated, simplified, and directed them to be more practical. This is how the learning content core of this book was created.

On the principle of free software and free knowledge, Svetlin Nakov led a team of volunteers and started this open-source project, initially to create a book based on programming with the C# language and later with other programming languages.

Authors Team

This book, "JavaScript Basics", was developed by a broad author's team of volunteers who took their time to give you this systematic knowledge and guidance at the start of programming. List of all book authors and editors (alphabetically):

Boncho Vulkov, Christian Hristov, Dimitar Dalev, Elena Rogleva, Hristo Minkov, Ivelin Arnaudov, Julieta Atanasova, Kristian Marianov, Martin Chaov, Nikolay Bankin, Nikolay Kostov, Pavel Kolev, Petar Ivanov, Stiliyan Kangalov, Svetlin Nakov, Ventsislav Petrov, Zahariya Pehlyavanova, Zdravko Kostadinov

The book is based on its initial C# variant (Programming Basics with C#), which is developed by a large team of authors that has a significant contribution to the current book. Below is a list of the additional book contributors (editors, translators, others):

Aleksander Krastev, Aleksander Lazarov, Aleksander Peev, Alen Paunov, Angel Dimitriev, Ariet Motzeva, Daniel Tsvetkov, Denis Milanov, Dimitar Dimitrov, Dimitar Tatarski, Dimo Dimov, Diyan Tonchev, Elena Rogleva, Hristiyan Hristov, Hristo Hristov, Iskra Nikolova, Ivelin Kirilov, Julieta Atanasova, Kalin Primov, Kristiyan Pamidov, Luboslav Lubenov, Nikolay Bankin, Nikolay Dimov, Pavlin Petkov, Petar Ivanov, Rositsa Nenova, Rozalina Zaharieva, Ruslan Filipov, Stefany Boyanova, Stefany Ilieva, Stefka Vasileva, Svetlin Nakov, Teodor Kurtev, Todor Cholakov, Tonyo Zhelev, Tsvetan Iliev, Vasil Krumov, Vasko Viktorov, Ventsislav Petrov, Violeta Taseva, Yanitsa Vuleva, Yulian Linev, Zahariya Pehlivanova, Zhivko Nedyalkov.

Cover design: Marina Schiderova.

Official Website of The Book

The current book on The basics of JavaScript programming for beginners is available for free use on the Internet from:

This is the official website of the book and there will be uploaded its latest version. The book has been similarly translated to other programming languages listed on its website.

Forum for Your Questions

Ask your questions to this book on Programming Basics in the SoftUni’s Reddit:

In this discussion forum, you will receive a free adequate answer on any questions from the curriculum content of this textbook, as well as on other programming issues. The SoftUni community for entering programming is so large that usually is an answer to a question is received within a few minutes. SoftUni's teachers, assistants, and mentors also answer your questions constantly.

Due to a large number of students in this textbook, in the forum, you can find a solution to virtually any task from it, shared by your colleague. Thousands of students before you have already solved the same tasks, so if you're in trouble, look around the forum.

If you still have a specific question, such as why a program doesn't run, that you've been stuck with for a few hours, ask it in the forum and you'll get an answer. You will be surprised how well-intentioned and responsive the users of the SoftUni’s Forum are.

License and Distribution

The book is distributed for free in electronic format under an open CC-BY-NC-SA license CC-BY-NC-SA.

The source code of the book can be found on GitHub:

International Standard Book Number (ISBN): 978-619-00-1401-0.

Bug Reports

If you find bugs, inaccuracies, or defects in the book, you can report them in the official tracker of the project:

We do not promise that we will correct everything you send us, but we are willing to constantly improve the quality of this book so that the reported unmistakable errors and all reasonable suggestions will be addressed.

Enjoy Your Reading!

And be sure to write code in large quantities, try the examples from each topic and, above all, solve the tasks from the exercises. With just reading, you won't learn to program, so make sure you put time into solving exercises!

results matching ""

    No results matching ""