{"id":22310681,"url":"https://github.com/codewith-ark/javascript","last_synced_at":"2025-07-02T03:33:57.203Z","repository":{"id":149599604,"uuid":"614675805","full_name":"Codewith-ARK/JavaScript","owner":"Codewith-ARK","description":"Learning JavaScript by coding. The following branch contains codes (in JavaScript language) for each of the programming concept","archived":false,"fork":false,"pushed_at":"2024-03-25T06:41:49.000Z","size":4938,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T02:12:57.495Z","etag":null,"topics":["javascript","learning-by-doing","learning-js"],"latest_commit_sha":null,"homepage":"https://codewith-ark.github.io/JavaScript/","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/Codewith-ARK.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-16T04:37:52.000Z","updated_at":"2023-12-02T09:22:23.000Z","dependencies_parsed_at":"2023-12-02T10:24:05.535Z","dependency_job_id":"fe33038d-61a0-400e-96b0-fbab5afde025","html_url":"https://github.com/Codewith-ARK/JavaScript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Codewith-ARK/JavaScript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codewith-ARK%2FJavaScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codewith-ARK%2FJavaScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codewith-ARK%2FJavaScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codewith-ARK%2FJavaScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Codewith-ARK","download_url":"https://codeload.github.com/Codewith-ARK/JavaScript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codewith-ARK%2FJavaScript/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263070245,"owners_count":23409094,"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":["javascript","learning-by-doing","learning-js"],"created_at":"2024-12-03T21:14:08.639Z","updated_at":"2025-07-02T03:33:57.182Z","avatar_url":"https://github.com/Codewith-ARK.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning JavaScript\n\n- Getting Started\n- JS in the Web Browser\n- [`console.log()`](#consolelog)\n- [Variables](#variables)\n- [Data Types](#primitive--non-primitive-data-types)\n- [String Concatenation](#string-concatenation)\n- [Operators]()\n- Conditional Statements\n\n## Console.log()\n\nThis is the method used to output text onto the console **(not the screen)**\n\n```js\nconsole.log(\"Hello World!\"); //semi-colons are optional\n\n// you can format the code in Console bu using `%c`\nconsole.log(\"%c Hi There!\", \"color:blue; font-size:48px;\");\n```\n\n---\n\n## Variables\n\nThere are (3) keywords to declare variables:\n\n- `var` the most lenient type of Variables.\n- `let` included in ES6 somewhat strict type of variables\n- `const` used to create constant (unmodifiable variables)\n\n---\n\n## Variables\n\nThere are (3) ways to create a variable in JS:\n\n- `var`: creates a somewhat global variable.\n- `let`: creates a scoped variable\n- `const`: creates a CONSTANT variable\n\n```js\n/*  Using let */\nlet _var = 67;\n\nfunction myFunc() {\n  // this variables is only accessible inside the function.\n  let _var = 100;\n}\n\n/* Using const */\n// this variable can not be 'reassigned'\nconst _constant = \"I am unchangeable\";\n\n/* Using var */\n// This variable can be accessed EVERYWHERE in the code\nvar _anotherVar = null;\n```\n\n---\n\n## Primitive \u0026 Non-Primitive Data Types\n\n**Primitive**: Data types that are built-in to the language. Examples are:\n\n```js\n// nn bb ss u\nlet _null = null;\nlet _num = 34;\nlet _bool = true;\nlet _bigInt = 456n;\nlet _string = \"ARK\";\nlet _symbol = Symbol(\"I am a Symbol!\");\nlet _undef = undefined;\n```\n\n**Non-Primitive**: Data Types that are user-defined. Examples are: Objects.\n\n```js\nlet _myObj = {\n  name: \"ARK\",\n  age: 19,\n  skinColor: \"Dark Orange\",\n};\n```\n\nIn the above code an object is assigned to the variable named '\\_myObj'. The object contains `key-value pair` this means every properties of object can be accessed by a specific key. There are several ways to access the properties of an object\n\n### **Using dot (.) operator:**\n\n```js\nlet name = _myObj.name;\nconsole.log(name);\n\n// output: \"ARK\"\n```\n\n### **Using Object Literal:**\n\n```js\nlet age = _myObj[\"age\"];\nconsole.log(age);\n\n// Output: 19\n```\n\n## String Concatenation\n\nConcatenation is the process used to combine two or more string together. There are severel ways of concatenating String in **JavaScript**\n\n1. using the `concat` method\n1. using the `+` operator\n1. using the `,` operator\n\n---\n\n**Method 1:**\n\n```js\nstr1 = \"My\";\nstr2 = \"String\";\n\n// combines the two existing strings\nstr3 = str1.concat(str2);\n\n// MyString\n```\n\n**Method 2:**\n\n```js\nstr1 = \"My name is\";\nstr2 = \"ARK\";\n\nconsole.log(str1 + str2);\n\n// My name isARK\n```\n\n**Method 3:**\n\n```js\nstr1 = \"My name is\";\nstr2 = \"ARK\";\n\nconsole.log(str1, str2);\n```\n\n---\n\n## Loops\n\nThere are many types of loops in JS:\n\n- `For loop`\n\n```js\nfor (let i = 0; i \u003c 11; i++) {\n  console.log(i);\n}\n```\n\n- `For-in loop:` Used for printing the values of an object\n\n```js\n// An object literal assigned to a variable named 'Obj'\nlet obj = {\n  name: \"ARK\",\n  age: 19,\n  isMale: true,\n};\n\nfor (let keys in obj) {\n  console.log(`${keys}: ${obj[keys]}`);\n}\n\n/*\nOutput:\n    name: ARK\n    age: 19\n    isMale: true \n*/\n```\n\n- `For-of loop:` used to iterate over the elements of an Array\n\n```js\n// Array of fruits (string).\nlet arr = [\"lemon\", \"banana\", \"apple\", \"strawberry\"];\nfor (let item of arr) {\n  console.log(`${item}`);\n}\n/* \nOutput: \n    lemon\n    banana\n    apple\n    strawberry \n*/\n```\n\n- `While Loop`\n\n```js\nlet i = 0;\nwhile (true) {\n  console.log(++i);\n}\n// Output: 1, 2, 3...\n```\n\n---\n\n## String Methods\n\n```js\nlet name = \"ark\";\nconsole.log(name.length); // tells the number of charachters present in the string\nconsole.log(name.toUpperCase()); // converts the string to UPPERCASE\nconsole.log(name.toLowerCase()); // converts the string to lowercase\nconsole.log(name.replace(\"a\", \"s\")); // replaces 'a' in string 'ark' with 's'. Output: 'srk'\n```\n\n---\n\n## Arrays\n\nA data type that is used to store collection of data types.\n\n```js\nlet arr = [\"banana\", 70, 3.142, true];\n```\n\n## Methods of Array\n\n```js\narr.push(\"ARK\"); // adds new element at the end\narr.pop(); // removes element from the end\narr.shift(); // removes element from the front\narr.unshift(); // adds element from the front\n```\n\n### Turnary Operator\n\nSyntax:\n\n```js\ncondition ? if_true : if_false;\n```\n\nExample:\n\n```js\nlet result = 1 \u003e 2 ? \"1 is greater than 2\" : \"1 is NOT greater than 2\";\nconsole.log(result);\n```\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewith-ark%2Fjavascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewith-ark%2Fjavascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewith-ark%2Fjavascript/lists"}