{"id":23516536,"url":"https://github.com/spaciouscoder78/javascript-for-beginners","last_synced_at":"2025-10-03T16:24:49.095Z","repository":{"id":39535504,"uuid":"505460183","full_name":"SpaciousCoder78/javascript-for-beginners","owner":"SpaciousCoder78","description":"A javascript tutorial for beginners","archived":false,"fork":false,"pushed_at":"2022-08-06T09:08:34.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-16T22:35:00.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpaciousCoder78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-20T13:48:03.000Z","updated_at":"2022-08-05T15:02:45.000Z","dependencies_parsed_at":"2022-08-01T08:38:59.998Z","dependency_job_id":null,"html_url":"https://github.com/SpaciousCoder78/javascript-for-beginners","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaciousCoder78%2Fjavascript-for-beginners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaciousCoder78%2Fjavascript-for-beginners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaciousCoder78%2Fjavascript-for-beginners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpaciousCoder78%2Fjavascript-for-beginners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpaciousCoder78","download_url":"https://codeload.github.com/SpaciousCoder78/javascript-for-beginners/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254042418,"owners_count":22004901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-25T15:13:34.556Z","updated_at":"2025-10-03T16:24:44.060Z","avatar_url":"https://github.com/SpaciousCoder78.png","language":"JavaScript","readme":"# javascript-for-beginners\nA javascript tutorial for beginners\n\n# Contents\n- [Introduction](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#introduction) [](url)\n- [Hello World Program](https://github.com/SpaciousCoder78/javascript-for-beginners#creating-a-hello-world-program) [](url)\n- [Comments](https://github.com/SpaciousCoder78/javascript-for-beginners#comments) [](url)\n- [Variables](https://github.com/SpaciousCoder78/javascript-for-beginners#variables) [](url)\n- [Constants](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#constants) [](url)\n- [String Indexing](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#string-indexing) [](url)\n- [String Methods](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#string-methods) [](url)\n- [String Concatentation](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#string-concatenation) [](url)\n- [If else condition](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#if-else-condition) [](url)\n- [Nested if condition](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#nested-if-condition) [](url)\n- [Else if condition](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#nested-if-condition) [](url)\n- [Switch Statement](https://github.com/SpaciousCoder78/javascript-for-beginners/tree/main#switch-statement) [](url)\n- [While loop](https://github.com/SpaciousCoder78/javascript-for-beginners/tree/main#while-loop) [](url)\n- [For loop](https://github.com/SpaciousCoder78/javascript-for-beginners/tree/main#for-loop) [](url)\n- [Break statement](https://github.com/SpaciousCoder78/javascript-for-beginners/tree/main#break-statement) [](url)\n- [Continue statement](https://github.com/SpaciousCoder78/javascript-for-beginners/tree/main#continue-statement) [](url)\n- [Do while loop](https://github.com/SpaciousCoder78/javascript-for-beginners/tree/main#do-while-loop) [](url)\n- [Arrays](https://github.com/SpaciousCoder78/javascript-for-beginners/blob/main/README.md#arrays) [](url)\n\n# Introduction\n\n\nJavascript is a client side high level, just in time compiled programming language which is widely used on the internet alongside HTML and CSS. \nAlmost every modern browser can natively run Javascript.\nYou can run javascript code in your browser’s console.\nYou can access your browser’s console by hitting the F12 key.\n \n![image](https://user-images.githubusercontent.com/88923986/174623199-e18ceb0f-19a4-4da3-b4f1-e4d203dcc7b8.png)\n\n## Writing javascript code within HTML code\nYou can write javascript code within your HTML code by using \u003cscript\u003e tag. All the javascript code goes within the tags.\n ![image](https://user-images.githubusercontent.com/88923986/174623842-5c2a5442-5907-4889-a2ac-4e8a669f34fb.png)\n\n \nOr you can create a separate .js file and link it in your HTML code.\n \n ![image](https://user-images.githubusercontent.com/88923986/174623896-9e2c3c88-184b-4536-a76d-9976d5611b42.png)\n\n# Creating a hello world program\nJust like in python, the length of hello world program in javascript is just one line.\n\n![image](https://user-images.githubusercontent.com/88923986/174624105-8dcd4431-e796-43a2-a3f0-b60f7d25467f.png)\n\n# Comments\n\nComments are used for documentation purposes and are not executed when the program runs.\nIn Javascript you can add comments using //\n\n ![image](https://user-images.githubusercontent.com/88923986/175223617-0474e3e2-bb23-463b-891d-3e99171dfeea.png)\n\n# Variables\nVariables can store some information and the stored information can be changed at a later time\n## Declaring a variable\nWe can declare a variable by typing “var variablename=value;”\nWe can also use 'let' instead of var\n \n![image](https://user-images.githubusercontent.com/88923986/175541294-1fbe79f9-729a-4f99-9c81-99a8ba84a4ca.png)\n## Using a variable\nWe can use a variable anywhere by mentioning it. \n\n![image](https://user-images.githubusercontent.com/88923986/175541410-59342ed8-9cdc-4150-9758-a769acf28e50.png)\n## Changing value of a variable\nWe can change the value of a variable by redefining it. We do not have to mention var while redefining a variable.\n\n![image](https://user-images.githubusercontent.com/88923986/175541645-d3e07a7c-0afe-4195-8e61-0e858e18194e.png)\n\n## Rules for naming a variable\n\nWe need to follow certain rules while naming variables. Not following the rules will get us some errors.\n\nRules:\n- Variable cannot start with a number(eg. 1value)\n- We can use only underscore(_) or dollarsign($) in the beginning of a variable name\n- We cannot use spaces while naming variables\n \n# Constants\nConstants, unlike variables, have a fixed value, which means that the value of a constant cannot be changed.\n\n## Declaring a constant\nWe have to use 'const' before defining a constant\n \n![image](https://user-images.githubusercontent.com/88923986/176846631-2739e3bc-e034-48b9-8665-ef827681f666.png)\n \n# String Indexing\n When we declare a string, we can access individual characters of the string using index numbers. Index numbers start from zero.\n \n![image](https://user-images.githubusercontent.com/88923986/176847596-4e755718-0b94-49e9-ae73-66434c9859b1.png)\n\n## Printing a character of the string\n\nWe can print a character of the string using \"variablename[indexnumber]\"\n\n![image](https://user-images.githubusercontent.com/88923986/176848471-c5f07feb-529c-41c0-9ac5-79514c82d09e.png)\n\n## Length of the string\n \nWe can find the length of the string using \"variablename.length\"\n \n![image](https://user-images.githubusercontent.com/88923986/176848785-3a4668eb-c5ac-425a-a717-9164fe661f22.png)\n \n## Last Index of a string\n\nWe can find the last index of a string using \"variablename.length-1\"\n\n![image](https://user-images.githubusercontent.com/88923986/176849133-2bd3c338-5be5-4c74-80cf-7c853dac6b06.png)\n \n# String Methods\nWhen dealing with strings, we can use methods like trim(), toUpperCase(), toLowercase() and string slicing.\n\n## trim() method\n This method is used to remove whitespaces in a string\n \n ![image](https://user-images.githubusercontent.com/88923986/176851495-735d4c6d-716e-43fd-bbc4-86671b761620.png)\n\n## toUpperCase() Method\n This method changes the text in the string to uppercase \n \n ![image](https://user-images.githubusercontent.com/88923986/176852687-ac4fe6d5-312d-4a90-bab6-828c1f3dfada.png)\n\n## toLowerCase() Method\n This method changes the text in the string to lowercase\n \n ![image](https://user-images.githubusercontent.com/88923986/176852980-a1367d43-40ee-4d68-b39b-4b1c8b9f4431.png)\n\n## String Slicing\n We can slice a string by mentioning parameters using slice() function\n \n ![image](https://user-images.githubusercontent.com/88923986/176853669-db821336-d336-4317-8edd-6a3d99bbf1ba.png)\n \n## typeof operator\n We can use typeof operator to find the datatype of a variable\n \n ![image](https://user-images.githubusercontent.com/88923986/176859090-42436b1a-77f5-4a48-b924-553427cefaa9.png)\n\n## Converting number to string\n We can convert a number to string by concatenating it with \"\"\n \n ![image](https://user-images.githubusercontent.com/88923986/176860008-1c9549e0-b5c3-42b7-8a7d-628f91032b1c.png)\n\n \n## Converting string to number\n \nWe can convert a string to number by adding a plus sign before the string\n \n ![image](https://user-images.githubusercontent.com/88923986/176860314-eb5efdaf-0453-4c74-947e-77645ad6a9d4.png)\n \n# String Concatenation \n \n We can concatenate (add) two strings by using the plus(+) sign between the two strings\n \n ![image](https://user-images.githubusercontent.com/88923986/176861265-b6e6c177-fd20-4e12-9e31-bbb17a87676d.png)\n \n# If else condition\nWe can use if else condition using relational operators like \u003e, \u003c, =, ==, != etc\n\n![image](https://user-images.githubusercontent.com/88923986/179539302-4052f5de-b62b-476e-8260-5682e068d0ab.png)\n![image](https://user-images.githubusercontent.com/88923986/179539747-db7707fd-d6b7-41aa-b24d-199bfc139c90.png)\n\n# Nested if condition\n\n![image](https://user-images.githubusercontent.com/88923986/183103710-ccc8ffda-f30e-43bf-92e9-cc4612b97d45.png)\n\n# Else if condition\n\n![image](https://user-images.githubusercontent.com/88923986/183104433-86d1c1b4-8ebc-46e1-904f-ea7e45c1ddf2.png)\n                                                                   \n                                                                   \n# Switch Statement\nSwitch statement can be used instead of nested if else statements\n\n![image](https://user-images.githubusercontent.com/88923986/183106502-155ee847-18c1-43cc-a8a1-619e88fe7e5c.png)\n\n                                                                   \n                                                                   \n# While loop\n                                                                   \n![image](https://user-images.githubusercontent.com/88923986/183109366-424c3b49-e557-4a7a-909c-fc68b6131b27.png)\n                                                                   \n# For loop\n                                                                   \n![image](https://user-images.githubusercontent.com/88923986/183111101-0ffba387-7251-426a-a21f-825a66f64533.png)\n                                                                   \n# Break statement\n                                                                   \nBreak statement ends the loop if the break statement's condition gets satisfied\n \n![image](https://user-images.githubusercontent.com/88923986/183111640-ecad6751-d68d-4bb3-a16f-8ba2f23f8138.png)\n\n# Continue statement\n\nContinue statement continues the loop if the condition gets satisfied\n\n![image](https://user-images.githubusercontent.com/88923986/183112192-b4ab8e15-680c-4017-92f3-c73a603493b2.png)\n\n# Do while loop\n\nThis loop executes the code block once and continues doing so if the while loop condition is satisfied\n\n![image](https://user-images.githubusercontent.com/88923986/183235923-e4f05675-d28f-4c66-b372-c1d516c834b5.png)\n \n# Arrays\n \nArrays are a type of objects that store multiple values in a single variable\n\n![image](https://user-images.githubusercontent.com/88923986/183236460-8ce439b7-2329-4d18-8abb-6f3174a1e7af.png)\n\n## Array Indexing\n \n![image](https://user-images.githubusercontent.com/88923986/183236486-9f34e2af-3b90-487b-aafc-8286b5f3bb7b.png)\n\n## Array push\n \nPush() can be used to insert another value into the array\n \n![image](https://user-images.githubusercontent.com/88923986/183236571-f782e647-0abe-456a-bd22-d2b259a2dfb0.png)\n\n## Array pop\n \npop() can be used to delete the last element in the array\n \n![image](https://user-images.githubusercontent.com/88923986/183236645-45462f7f-80f4-462c-9ea1-55bbc01f1428.png)\n\n## Array Shift and unshift\n \nUnshift pushes the element in the beginning of array where as shift removes the first element of the array\n\n![image](https://user-images.githubusercontent.com/88923986/183236743-b7015332-e0cb-4cb5-8377-d37add1f018f.png)\n\n![image](https://user-images.githubusercontent.com/88923986/183236761-d8139993-5424-455c-8db7-8555166f4140.png)\n\n## Array concatenation\n\nWe can use concat() to concatenate arrays\n\n![image](https://user-images.githubusercontent.com/88923986/183242481-b8b08151-2ea4-482d-b0a3-539083efa589.png)\n\n## Array slicing\nWe can use slice() to return selected elements in an array as new array\n\n![image](https://user-images.githubusercontent.com/88923986/183242589-45b8f4be-8cb4-4f25-8a58-8d6fe202565d.png)\n\n \n\n\n\n                                                                   \n                                                                   \n\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaciouscoder78%2Fjavascript-for-beginners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspaciouscoder78%2Fjavascript-for-beginners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaciouscoder78%2Fjavascript-for-beginners/lists"}