teleren/devto huggingface dataset:
Javascript. Variables, Scopes
Published: 2022-11-09 12:04:12

Javascript, often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, and the most used programming language in the world. As of 2022, 98 percent of websites use Javascript. Like many other programming languages, JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container.
Before we use a variable in a JavaScript program, we must declare it. There are 3 main ways to declare the variables. The first one is var. For example,
var a = 5
var b = 20
var c = a + b
From these examples we can see that a stores value 5, b stores value 20, and c stores value 25.
The second option to declare variables is let. Let is a keyword that is used to declare a block-scoped variable. Usually, the var keyword is used to declare a variable in Javascript which is treated as a normal variable, but the variables declared using the let keyword are block scoped. Basically, let is block scoped, unlike var which is function scoped. Var also allows to redeclare variables, but let doesn’t. The last one is const. When we use the keyword const to declare variables, they cannot be changed. That name comes from the word Constant. Example,
const number1 = 6
const number2 = 50
let total = number1 + number2
Here number1, number2, and total are variables. Number1 and number2 cannot be changed, but the total can. 
As I mentioned in the differences of variables, key role plays a scope. In Javascript, a variable has 2 types of scope, global and local. A variable declared at the top of a program or outside of a function is considered a global scope variable. The value of a global variable can be changed inside a function. A variable can also have a local scope that can only be accessed within a function. In the global scope, we can only access global variables, which are stored in the object. Unlike global variables, local variables are not accessible and are destroyed as soon as their scope ends. The local scope can be divided into two scopes, block scope which I already mentioned, and function scope. If we use blocks anything between {}, such as if, switch, while, can make use of block scope only if you define a variable with let and const. Function scope specifies that the variables defined inside the function are only accessible within the function. They won’t be visible outside of a function.
Learning JS - Functions
Tags: javascript, beginners, functions, programming
Published: 2022-11-09 19:00:53

**What is "Function"?**
In JavaScript, a **function** is a collection of statements that executes an action or calculates a value (same as in maths). Function is a team that we can call when needed. However, to be considered a function, a process must accept input and provide an output.

The **function** keyword is used to define a JavaScript function, which is then followed by the function's name and parenthesis ().
A function is composed of a sequence of statements called the function body.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y97h316c8pwag99fvg3.png)

One of the Advantages of Functions is that we can reuse a code. Define the code once, and use it many times. We also can can use the same code many times with different arguments, to produce different results.

**How to name a Function?** 
As in variables, function names can contain letters, digits, underscores and dollar signs. It is better to write a descriptive name for your function. For example, if a function is used to add two numbers, you could name the function "add".


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5o7o1gmdsi8hyhufsxt.png)



Function arguments are the values received by the function when it is invoked (called). The arguments are inside the () braces.

We are capable of using the Function as a variable value.
`let x = function() {

}`

Later, we can call the function using the variable like this:
x();

While calling a function x(), we can input a value in the braces such as x(19). In this case, the value 19 will be conveyed to the argument of the function and used for calculating results.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qw62h30y9em8zxb1d9zw.jpg)

Also we can have multitude of arguments:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qykjdnqzvd77on6zicci.jpg)

A specific value from the function is returned to the function caller using the **"return"** statement. When the return statement is called, the function will end. The code that follows the return statement won't be accessible, thus it should be the **last statement of the function.**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sjtpkgv2ffrq2z7c58sl.png)

Java Script has **Function Scope**. A new scope is created by each function in JavaScript. A function's declared variables cannot be accessed or seen from outside the function.

Simple right? If you have questions do not hesitate to write me! Thanks for your attention. See you :))
5 Reasons Why You Should Start Learning About Web3 Today
Tags: webdev, javascript, react, web3
Published: 2022-11-09 18:45:23

If you're reading this, it's likely that you're at least somewhat familiar with the basics of the web. But what you may not know is that the web is in the midst of a major transformation. The way we interact with the internet is changing, and a new technology called web3 is at the heart of this change.

Web3 is a set of protocols and technologies that enable a decentralized web. This means that instead of relying on central authorities like governments or corporations, web3 users can interact directly with each other. This has a number of advantages, including increased security, privacy, and censorship resistance.

If you're not familiar with web3, now is the time to learn about it. Here are five reasons why you should start learning about web3 today:

## 1. The web is changing

The way we interact with the internet is changing. More and more people are using decentralized applications (dApps) that run on web3. These dApps are built on top of platforms like Ethereum and allow users to interact with each other directly, without the need for central intermediaries.

## 2. Web3 is more secure

Because web3 is decentralized, it is more resistant to security threats. There is no single point of failure that can be exploited by hackers. Additionally, web3 users have full control over their data and can choose who to share it with.

## 3. Web3 is more private

Web3 is also more private than the traditional web. When you use a centralized service like Facebook, your data is stored on servers that are controlled by the company. But with web3, your data is stored on a decentralized network of computers, making it much more difficult for companies to track and sell your data.

## 4. Web3 is more censorship-resistant

Another advantage of web3 is that it is more censorship-resistant. Because there is no central authority controlling the network, it is very difficult for anyone to censor or block content. This makes web3 an ideal platform for free speech and open dialogue.

## 5. You can be part of the change

Finally, by learning about web3, you can be part of the change. The traditional web is centralized and controlled by a few giant companies. But with web3, everyone can participate in building the new decentralized web.

So, if you're not familiar with web3, now is the time to start learning about it. It's a new way of interacting with the internet that has a number of advantages over the traditional web. By learning about web3, you can be part of the change and help build the new decentralized web.

---

## The easiest way to create an NFT collection

NFTs Lab is the ultimate solution for creating NFTs collections and making smart contracts without any coding complexity.

Keep up with the latest from NFTs Lab by following us on Twitter: [@TheNFTsLab](https://twitter.com/TheNFTsLab).

![](https://res.cloudinary.com/practicaldev/image/fetch/s--B7QH-Oel--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cwd0uokfjxnjw1d7t5ld.png)
Part time remote jobs - RevampedCP
Tags: career
Published: 2022-11-09 18:38:59

####   Original Tweet From  [@RevampedCP](https://twitter.com/RevampedCP)
{% embed https://twitter.com/RevampedCP/status/1589999674282643456 %}

Part-time, Contractor, Capture Services Coordinator
https://jobs.lever.co/matterport/a0ed17bf-f07c-459c-a3cf-3454c16ff282?lever-source=LinkedInJobs
AdSpace Here!!
Search Specialist (part-time, remote)
 [https://www.on-ramps.com/jobs/2893](https://www.on-ramps.com/jobs/2893) 

IT Mentor (Part-time)
https://jobs.lever.co/pathrise/adc62548-8f6e-4e1b-9441-29e3e7ad01ca?lever-source=LinkedInJobs

AdSpace Here!!
Cash Analyst (Part-Time PM)
https://careers.fisglobal.com/us/en/job/FIGLUSJR0230660EXTERNAL/Cash-Analyst-Part-Time-PM

Mentor - Data Analytics Career Track (Part-time/Remote)
https://boards.greenhouse.io/springboardmentors/jobs/400502400

Data Annotator - Bilingual/Spanish - Part Time
https://jobs.lever.co/cogitocorp/67941cf5-f3ce-4290-a233-95a24e56727b

AdSpace Here!!
Campaign Marketer, Part-Time
https://careers-republic.icims.com/jobs/1126/campaign-marketer%2525252c-part-time/job


Client Intake Support (Part-time)
https://boards.greenhouse.io/growtherapy/jobs/4080184005

B2B Social Media Specialist (Part-Time)
https://www.yelp.careers/us/en/job/YELPUSDB45D7ECF99F43E1A3F47DDBE31785B6EXTERNALENUS/B2B-Social-Media-Specialist-Part-Time
AdSpace Here!!
Part-Time Coupon Editor (Remote)
[https://slickdeals.net/job/?gh_jid=6446892002](https://slickdeals.net/job/?gh_jid=6446892002) 

Part-Time Marketing Clerk
[https://careers.southwire.com/ShowJob/Id/649256/Part%20Time%20Marketing%20Clerk](https://careers.southwire.com/ShowJob/Id/649256/Part%20Time%20Marketing%20Clerk) 

Administrative Assistant, Technology (part time) - Remote
https://jobs-sagepub.icims.com/jobs/6362/administrative-assistant%252c-technology-%2528part-time%2529---remote/job
AdSpace Here!!

Click [Here](https://www.knowledge-twitter.com/?utm_source=dev.to)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/?utm_source=dev.to)
JavaScript Variables
Published: 2022-11-09 18:35:24

Variables are used to hold a value. It can hold any value, from primitives to objects. JavaScript supports five different types of variable. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovjsjvyvhx7xcrudpe6k.png)


**4 Ways to Declare a JavaScript Variable:**
Using **_var_**
Using **_let_**
Using **_const_**
Using **_nothing_**

Scope determines the accessibility (visibility) of variables.

JavaScript has 3 types of scope:
1)**Block scope**
2)**Function scope**
3)**Global scope**
_________________________________________________________________
**Block Scope**
_Let_ and _const_ provide _Block Scope_ in JavaScript.
Variables declared inside a { } block cannot be accessed from outside the block:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/puu16e5zlnkq83rwa5hc.png)

Variables declared with the **_var_** keyword can NOT have block scope.
Variables declared inside a { } block can be accessed from outside the block.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cwl78yv4mrheqgkn5eoo.png)
              ---   ---   ---   ---   ---   ---
Variables declared within a JavaScript function, become _LOCAL_ to the function.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/107abylym5ndm16nn5hw.png)
              ---   ---   ---   ---   ---   ---

**Function Scope**
JavaScript has _Function scope_: Each function creates a new scope.

Variables defined inside a function are not accessible (visible) from outside the function.

Variables declared with _var_, _let_ and _const_ are quite similar when declared inside a function.

They all have Function Scope:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yhv6wxgrv2nxk0z9sjfq.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uv3032fbfux4fnamgxem.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hu6tfiz4g0r85zw46v8.png)

**Global JavaScript Variables**
A variable declared outside a function, becomes GLOBAL.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nmuqk95i7fab5bay92bu.png) 
              ---   ---   ---   ---   ---   ---
Variables declared Globally (outside any function) have **Global Scope.**
Global variables can be accessed from anywhere in a JavaScript program.
Variables declared with var, let and const are quite similar when declared outside a block.
They all have Global Scope:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hvyrqrcnxyx4lp2rewg.png)
              ---   ---   ---   ---   ---   ---

The = sign in JavaScript isn't the same as the = sign in Math. In JavaScript, = means assignment.
JavaScript Functions
Published: 2022-11-09 18:30:33

## Functions
Functions in Javascript do the exact same thing as functions in mathematics: they take some values, do some operations on them and then give us back a new result.
## How a Function Works
Like variables functions should be given a name. then in front of the given name we open a parenthesis () to put out our variables or our inputs. Then we put a curly bracket {} and inside the brackets we write the operation that the function is supposed to do. We call all these steps, declaring a function. However, for a function to actually get its values, we need to call it as well. Calling a function means that after we name the function, somewhere outside the function, whether before or after the function, we write the name of the function, open a parenthesis () and write our actual values. If we don’t call the function, the function will not be able to receive its inputs since the only source of it getting its desired values is the line of code that calls it. See the example below to understand this matter more:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7hk0edfuych5pg1agdp.png)
## Something More We Can Do With a Function
We can call a function inside another function. See the example below:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dw8736zyuqmyp4n1317o.png)
Global remote jobs - RevampedCP
Tags: career, jobs
Published: 2022-11-09 18:25:22

####   Original Tweet From  [@RevampedCP](https://twitter.com/RevampedCP)
{% embed https://twitter.com/RevampedCP/status/1590089929052549120 %}


Delivery Manager at [@oriuminc](https://twitter.com/oriuminc) in Canada 🇨🇦 
https://t.co/6d4RB9ZE4T 

Global Channels Specialist at [@nylas](https://twitter.com/nylas) in Canada 🇨🇦 
 [https://boards.greenhouse.io/nylas/jobs/4129612005?gh_src=26cebd785us](https://boards.greenhouse.io/nylas/jobs/4129612005?gh_src=26cebd785us) 

AdSpace Here!!
Revenue Systems Analyst at [@SkyWatchApps](https://twitter.com/SkyWatchApps) in Canada 🇨🇦 https://t.co/Myx7auAQvU 

AdSpace Here!!
Process Analytics &amp; Improvement Lead at [@Canonical](https://twitter.com/Canonical) in Nigeria 🇳🇬  

[https://boards.greenhouse.io/canonicaljobs/jobs/4129086?gh_src=8e11eca81us](https://boards.greenhouse.io/canonicaljobs/jobs/4129086?gh_src=8e11eca81us) 

Senior Finance Manager at [@bp_America](https://twitter.com/bp_America) in Nigeria 🇳🇬 
 [https://careers.bpglobal.com/TGnewUI/Search/home/HomeWithPreLoad?PageType=JobDetails&partnerid=25078&siteid=5012&jobId=156984](https://careers.bpglobal.com/TGnewUI/Search/home/HomeWithPreLoad?PageType=JobDetails&partnerid=25078&siteid=5012&jobId=156984) 
AdSpace Here!!
Corporate Retention Associate at Reliance Health in Nigeria 🇳🇬 https://t.co/aAi1pXntuX 



Click [Here](https://www.knowledge-twitter.com/?utm_source=dev.to)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/?utm_source=dev.to)
Turn a Psalm report to HTML in three easy steps!
Tags: php, psalm, tutorial, guide
Published: 2022-11-09 18:12:20

## Introduction

Okay so this kinda blew my mind how easy and magical it is, and am mainly writing down this post for myself to remember it.

Basically, in case you did not know already, Psalm is a great static analysis tool for PHP, but if you have a ton of errors it can be hard to keep track of everything when your terminal gets flooded.

Wouldn't it be much easier if you could get the output as an HTML page? While there's no built-in tool for this as far as I can tell, the workaround is surprisingly simple. Let's get to it.

### Prerequisites

This guide assumes you already have Psalm set up. You need no additional tools downloaded for this.

## Step 1 - Running Psalm

First off, we need to run Psalm, the key here is to save the report as an XML file. This is easy enough to do by redirecting the output to a new file.

```bash
vendor/bin/psalm --output-format=xml > psalm-report.xml
```

## Step 2 - Running the Transformer

This is where the fun part comes in, using something called an XSL Transformer (XSLT) we can transform the XML to HTML. The common way to do this seems to be by using the [xsltproc](http://xmlsoft.org/xslt/xsltproc.html) software, but I don't want to have to download a bunch of stuff, and you know what? We don't have to. We can run xsltproc online!

Simply visit [freeformatter.com/xsl-transformer](https://www.freeformatter.com/xsl-transformer.html), and copy your XML document to the first input. In the second input you'll need to add the XSL stylesheet which you can copy from this file: [psalm-html-output.xsl](https://raw.githubusercontent.com/Roave/psalm-html-output/1.1.x/psalm-html-output.xsl).

## Step 3 - Saving as local HTML

After the online conversion, all you need to do is copy the contents into a new HTML file in your local text editor. It's just that easy!

![Screenshot of the result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7z3dnbd015hdztozg42q.png)


## Conclusion and Credit

As a sidenote, if you have xsltproc installed, or are willing to install it, you can run all three steps in one via the command line. For that, I defer to the readme of this repository where we got the XSL from https://github.com/Roave/psalm-html-output. Huge thanks to them for creating the XSL document, they did all the work!
dev.to codes! This is really cool 🤓
Tags: meta, bestofdev, ruby
Published: 2022-11-09 18:08:39

I just wanted to point folks here:

{% embed https://dev.to/thormeier/devto-codes-collaborative-coding-experiment-the-most-liked-comment-picks-the-next-line-of-code-day-2-36c2 %}

This is a really fun activity and I'd love to see where it goes.

If you want to make sure you don't miss anything in this series, follow @thormeier right away!
dev.to codes! Collaborative coding experiment: The most liked comment picks the next line of code, day 2
Tags: programming, community, fun, ruby
Published: 2022-11-09 17:59:23

Day 2! The response on the first post was amazing, thanks to everyone that contributed! @ben's comment got the most likes and you all decided that we'll go with Ruby.

This experiment is inspired by a [post on the ProgrammerHumor subreddit](https://www.reddit.com/r/ProgrammerHumor/comments/yot55f/the_most_upvoted_comment_picks_the_next_line_of/), where the original author did this exact thing: The most liked comment after 24 hours picks the next line of code.

**The rules:**

 * Nothing that's against any applicable law
 * Nothing that's against the community code of conduct, terms of use, or privacy policy
 * No leaking of personal information of anyone
 * No malware/ransomware/viruses/etc.
 * Keep it civil
 * (To be expanded, depending on the case)

Our code so far:

```ruby
emotions = ["🥲", "🥰", "🥺", "😫", "🤬", "😞", "😅", "😊", "😰"]
```

See you in 24 hours!

**EDIT: Voting has ended! If you want to contribute code or likes, please see the newest post of the series.**
Why you're only seeing a Readme.md file on your github pages
Tags: github, tutorial, webdev
Published: 2022-11-09 17:57:41

## Why is my website not showing ?

The answer to that question is that perhaps you have been pushing all of your files into the same directory where the "Readme.md" file is present such as the main/master branch. 

When you created your pages website you most likely deployed it from the main branch where all your files are present. 

## How do I fix it ?

A smart trick is to create a new branch inside of your repository. Go to Github and Navigate to Create a new branch and name it whatever you want. After that make sure that you pull the branch to your local machine but using the command `git fech --all` and `git pull origin main`. Then I would suggest to open the repository using `open .`. Navigate to the "Readme.md" file and move it to the trash or delete it. Go back to your terminal and notice with `git status` that the file has been deleted. Then push the changes `git add .` `git commit -m "Removed Readme file"` `git push origin main`. Notice now that if you go back to the main branch using `git checkout main` and type `ls`, your file still exists on your main branch but not on your secondary branch such as "gh-pages". Check this by typing `git checkout gh-pages` and `ls`. To see that it is only present in one of the branches. Now when you want to deploy your website make sure to choose the appropriate branch where you know the Readme.md file isn't present whilst people that visit your Github repository will still be able to read to file to find information. :)
JavaScript Variables
Published: 2022-11-09 17:52:30

## Introduction
Variables are one of the fundamentals that enable a Javascript code run in the first place. Variables hold values and are crucial in displaying the final outcome of a code.

## Types of Variables
There are three types of variables: first one is called 'var', second one is called 'let' and the third one is 'const'.

## Making a Variable Work
Though we named the three different variables, but their names are not enough for a functioning program. To make a variable work, we need to do two things: first is 'Declaring' the variable and then 'Assigning' variable.

## Declaring and Assigning
Declaring a variable means writing a word or a name which is dedicated to that certain variable. For instance by writing ' let a; ', we declare the variable and name it 'a'. however, for a variable to give an output, it needs to contain some value as well. Giving a value to a variable is what we call 'Assigning' a variable. For instance; by writing ' let a = 10 ', we are declaring the variable 'let' by naming it 'a' and assigning a value number '10' to it. Values for a variable can be a number or a word/sentence which in programming terms are called 'strings'.
## Differences Between Let, Var, Const
Let and var are pretty similar. However, const is a bit different than the other two types and the difference is whether they can be reassigned. Let and var can be reassigned throughout the code. However, const cannot be reassigned. You can see the examples below to understand this concept better.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bl01d13iqeuay554x74k.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4mesp1u2c0wuvz4t1hx.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7rsycd5baixsmoo3esy.png)
## Scopes
There are three types of scopes: global, function and block. Global scopes are variables that are declared and assigned outside of a function. Function scopes are variables that are declared and assigned inside of a function and Block scopes are variables that are declared and assigned inside of a block and cannot work anywhere else in the code unless an object is created for them. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/my5yub3r0jbn1jzx3kjq.png)