teleren/devto huggingface dataset:
Iniciando no Nestjs
Tags: beginners, node, nestjs, tutorial
Published: 2023-06-24 02:52:04

Criado em 2017, o Nestjs é um framework de código aberto e destinado a softwares do lado do servidor.
Orientado a objetos, o NestJS possuí um grande potencial no seu desenvolvimento e desempenho nas aplicações e economia de tempo. O NestJS é inspirado no Angular, a maior parte do que se encontra no Angular também pode ser encontrado no NestJS, como provedores, middleware, componentes e serviços.

**Principais vantagens**

- Confiável, amplamente suportado e bem [documentado](https://docs.nestjs.com)

- Rápido e capaz de lidar com solicitações simultâneas em escala

- Traz uma ótima flexibilidade graças a sua arquitetura modular, onde permite usar qualquer outras bibliotecas.

- Se destaca pela sua extensibilidade, versatilidade e progressividade, tirando vantagens de recursos mais recentes do Javascript

- Padrões de design e soluções modernas para o mundo Node.JS


**Quando usar**

NestJS é baseado em TypeScript e Javascript, roda do lado do servidor e cria aplicativos eficientes e agrupáveis, organizando todo o padrão de arquitetura com códigos de fácil manutenibilidade, escalonáveis e limpos.


### Instalação

Para começar, você pode montar o projeto com o [Nest CLI](https://docs.nestjs.com/cli/overview).

> $ npm i -g @nestjs/cli
> $ nest new project-name

No diretório do projeto será criado os módulos e alguns outros arquivos padrões que serão instalados e um diretório **src/** será criado e preenchido com vários arquivos principais.

> src
>   > app.controller.spec.ts
>   > app.controller.ts
>   > app.module.ts
>   > app.service.ts
>   > main.ts

O arquivo **main.ts** inclui uma função assíncrona, que inicializará nosso aplicativo

```
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}
bootstrap();
```

### Executando o aplicativo

Depois que o processo de instalação estiver concluído, você poderá executar o seguinte comando no terminal para iniciar o aplicativo que escuta as solicitações HTTP de entrada:

> $ npm run start

Após os passos acima, vá até o seu navegador e cole a url:
**http://localhost:3000**

## Conclusão

Com isso, você terá sua primeira aplicação Nestjs executando, para seguir mais abordagens do framework você pode seguir mais dicas na documentacão: https://docs.nestjs.com


## Referências

[Documentação](https://docs.nestjs.com)
[Projeto inicial](https://github.com/nestjs/typescript-starter)
[Por quê NestJs?](https://amplication.com/blog/why-choose-nestjs-as-your-backend-framework-amplication)
Survey: Is GPT-4 a Good Data Analyst?
Tags: gpt3, nlp, datascience
Published: 2023-06-24 02:36:56

## 選定理由

LLMの発展によってデータアナリストの仕事が消滅するのでは？という懸念から。

Paper: https://arxiv.org/pdf/2305.15038.pdf
Code: https://github.com/DAMO-NLP-SG/GPT4-as-DataAnalyst

Data-Copilotの論文[[Zhang2023](https://arxiv.org/abs/2306.07209)]でCitationされている。

## 概要

【社会課題】
データアナリストはビジネスパートナーの要求に基づいてデータベースから関連データを抽出し、理解しやすい形で可視化し、解析結果に対する考察を提供するという比較的定型業務が多い。そのため、LLMの能力が向上するにつれてデータアナリストという職業がAIで代替される懸念があり、大衆の注目を集めている。

【技術課題】
ビジネスクエスチョンに応じてデータベースのどの項目を取得し、どのような可視化を行うことがレポート作成に効果的であるかはドメイン知識が必要となる。e.g. サーバがなぜダウンしたか？という問いに対してはトラフィックのバースト検出の可視化等が効果的である。

【提案】
データスキーマとビジネスクエスチョンを入力とし、データアナリストの分析レポートをエンドツーエンドで出力させるフレームワークを提案した。ビジネスクエスチョンはLLMが持つ高い意図理解能力・ドメイン知識により、適切なデータ抽出処理、可視化処理、レポート生成処理が自動的に実行される。

【効果】
成果物としてのレポートはジュニアアナリストの品質よりも良く、シニアアナリストに匹敵することが確認された。コストと時間についてはもちろん比較にならないほどGPTが優位である。

## GPT-4 as a data analyst

3つのステップがある：(1) コード生成（青い矢印）、(2) コード実行（オレンジの矢印）、および(3) 分析生成（緑の矢印）。システムへの入力としてはビジネスクエスチョン（自然言語）とデータベーススキーマ(テキストデータ)のみである。

![tb1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qk42jhivrxqmdfehg9qm.png)

（1)コード生成では、セキュリティのためデータスキーマのみがGPTに提供される。GPTはテーブル1に示すようなプロンプトを受けて複数のデータベーステーブル間の関係を理解し、必要なクエリ及びpythonコードを生成する。（２）データの安全性を維持するため、コードとクエリ実行はオフラインで実行される。結果としてチャートのpdfファイルと取得したデータのtxtファイルが得られる。

![tb2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jaya46cmubq6cqgtfjyz.png)

（３）テーブル2に示すプロンプトを用いて、データ分析が元のクエリと整合していることを確認するために、質問と抽出されたデータの両方を入力として使用する。抽出されたデータに関する説明の段落を生成する代わりに、GPT-4に対してキーポイントを強調する5つの要点で分析と洞察を生成するように指示する。予備的な実験から、GPT-4は図を見ずにデータ自体からトレンドや相関を理解することができるとわかっている。
実際のデータアナリストの役割では、関連するビジネスの背景知識が必要な場合があるため、外部の知識源（例：Google）からリアルタイムのオンライン情報（I）をクエリするための外部知識検索モデルg(·)を設計した。このオプションでは、GPT-4はデータ（D）とオンライン情報（I）の両方を入力として受け取り、分析（A）を生成する。

![alg1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2od52tao4tjodl1y0r2.png)

提案するアルゴリズムの全体像は上記のようになる。

## 実験

![tb3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttge71uwg1686wjtxhh1.png)

「NvBench」データセットの様々なドメイン、チャートタイプ、難易度の質問から、100の質問をランダムに選択。チャートは棒グラフ、積み上げ棒グラフ、折れ線グラフ、散布図、グループ化散布図、円グラフをカバーしている。難易度は簡単、中程度、難しい、非常に難しいの４種、ドメインにはスポーツ、アーティスト、交通、アパートの賃貸、大学などが含まれている。レポートは5つの要点で記述し、評価指標を使用して品質を評価した。チャートはinformation correctness, chart type correctness, aestheticsで評価、文章はcorrectness, alignment, complexity, fluencyで評価した。なお、NvBenchから抽出した想定ビジネスクエスチョンは実際の業務に比べると実践的でない面があり、GPT-4でアナリストが代替されるかは更なる検証が必要である。

表３では、データアナリストとしてのGPT-4の性能が200のサンプルで評価した。chart type correctness, aesthetics に関しては高いが、information correctnessには改善の余地がある。文章評価に関してはGPT-4は平均してalignmentとfluencyで高スコアであった。correctnessスコアはチャートのcorrectnessよりも高かった。これは興味深く、生成された図表が間違っていても、文章は正しい場合があることを示す。先述したように、生成された図表は大部分が正しい図表と一致しているため、一部の箇所のみが誤っている。complexityスコアに関しては、平均して3点満点中2.16点と十分な結果であった。

![tb7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rsmnf8jqjdjb7jbb5sg.png)

生成されたレポートのサンプルがテーブル７である。適切なデータを抽出、チャート、レポートの作成ができている。以前から言われているが、複雑な数値演算に弱い側面が見られた。

アナリストとGPT-4の成果物の差として、1つはGPT-4の　hallucination　のような誤りがあり、アナリストはこのようなエラーは避ける。２つ目にアナリストは分析前の前提条件となる事を把握しているが、GPT-4は(プロンプトで与えない限り)全てを把握しているわけではない。
Setting up fastify
Tags: node, fastify, javascript, web
Published: 2023-06-23 18:43:54

Before we dive into creating POST and GET routes, let's set up Fastify in a new Node.js project. Ensure you have Node.js and npm (Node Package Manager) installed on your machine, and follow these steps:

Initialize a new Node.js project:

```
$ mkdir fastify-app
$ cd fastify-app
$ npm init -y
```

Install Fastify:

```
$ npm install fastify --save
```

Creating a Basic Fastify Server:

Once Fastify is installed, let's create a basic server configuration to handle HTTP requests. Create an index.js file in your project directory and add the following code:

```
// index.js
const fastify = require('fastify')();

fastify.get('/', async (request, reply) => {
  return { message: 'Welcome to my Fastify app!' };
});

fastify.post('/user', async (request, reply) => {
  const { name, email } = request.body;
  return { message: `Hello ${name} (${email})!` };
});

fastify.listen({ port: 3000 }, (err) => {
  if (err) {
    console.error(err);
    process.exit(1);
  }
  console.log('Server is running on port 3000');
});
```

In the code snippet above, we created two routes: a GET route ("/") and a POST route ("/user"). The GET route simply returns a welcome message, while the POST route expects a JSON payload containing user data. You can customize these routes according to your application's requirements.

Let's run our server with:

```
$ node index.js
```

and give it a try by running curl:

```
$ curl http://localhost:3000
{"message":"Welcome to my Fastify app!"}
```

or let's post a JSON object to out /user route:

```
$ curl -X 'POST' \
  'http://localhost:3000/user' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "user@example.com",
    "name": "Foo"
}'
{"message":"Hello Foo (user@example.com)!"}
```

As you can see, it is quite easy and effective to create a Web backend server with node.js and fastify!

In the next post we will take a look at validating the input and output data with JSON schema.

Stay fast!
Rust中可变引用和不可变引用不能同时存在的问题
Tags: rust
Published: 2023-06-24 02:05:00

- 这么设计的原因是为了防止数据竞争
- 但是下面的代码依然很难搞懂为何会编译报错：
```
fn main() {
    let mut a = 1;
    let c = &mut a;
    *c += 1; 
    println!("{}",a);
    println!("{}",c)
}
```
- 通过查找资料，能够得出的结论是在使用引用的时候不能同时使用可变引用和不可变引用
- 进一步了解到`println()`这个宏在打印输出变量值的时候，会自动创建一个对变量的不可变应用，来获取变量的值
- 所以当a的不可变引用没有被释放的时候，那么此时是不能再创建对于a的不可变引用的，而这个“创建”就是`println()`
- 那就是不可变引用什么时候被释放的问题了
- 通过一些资料能够得到：`println!("{}",c)`这行代码执行完a的不可变引用就释放了
WHY TYPESCRIPT IS BETTER THAN THAN USING JAVASCRIPT.
Published: 2023-06-24 01:28:56

In this article we will learn why Typescript is better and more efficient to use than Javascript. I am going to highlight 3 main advantage Typescript has over Javascript; 

**Why TypeScript over JavaScript?**

Due to its syntax, JavaScript code is not considered an error by TypeScript. This means that you don't need to worry about how the code is written because you can put any working JavaScript code into a TypeScript file.

**Is JavaScript quicker than TypeScript?**

TypeScript is more efficient and faster than JavaScript when it comes to execution speed and device scaling. The primary reason it outperforms JavaScript in terms of performance is that it is able to detect errors and bugs at the compilation stage rather than the runtime.

**What benefits does the TypeScript function provide?**

TypeScript's primary benefit is type checking. We will be able to identify many of these issues at build time if the language is given static typing. Before the code is shipped, they can be fixed.
Generate QR codes with Stable Diffusion and ControlNet
Tags: stablediffusion, controlnet, stablediffusionwebui, windows
Published: 2023-06-24 01:12:53

Generated QR codes with Stable Diffusion and ControlNet.
 

![first scannable](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zpqo3g7we2dh68ugly6d.png)


![wolf scannable](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q7k02ydpnwpa3pp76l35.png)


![bonsai scannable](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cs644ps95jnc62n0ezy6.png)


![building scannable](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/01u4i4pe268kz2sq79e8.png)


![ink painting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aik4gewecu9j58ixs5fn.png)


![robot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i94sgzqmggic4rl0ifge.png)
AI SEO Tools Are Beating Traditional SEO Methods
Tags: openai, google, seo, marketing
Published: 2023-06-24 00:57:42

My company, [Merchynt](https://www.merchynt.com), has been helping businesses with SEO for years. We focus mostly on local SEO, like Google Business Profiles (AKA Google My Business or GMB). We started using AI tools about 12 months ago and more recently built two of our own.

We're finding that our clients using our AI SEO tools are outranking the ones that have been using manual SEO services for much longer.

Is manual SEO work dead for local businesses, or do we think Google will learn what was done via AI and penalize the users?

The AI SEO tools we've created in case you're curious are [ProfilePro](https://www.merchynt.com/profilepro) & [RoboReply](https://www.merchynt.com/roboreply-ai-google-reviews-software).

The first is a Chrome extension we built using StabilityAI & OpenAI APIs and the latter is a full webapp that uses the Google Places API.
Write Simple RestAPI In Nim With Happyx #4
Published: 2023-06-24 00:15:52

Hi there! 👋

Previously we worked on posts 👨‍🔬

In this part we refactor our code and mount posts.

At first create `/src/mounts/posts.nim` and write
```nim
import happyx
```

In `main.nim` delete all routes that provides work with posts.
```nim
import
  # This will import HappyX framework
  happyx


# Setting up our server at `127.0.0.1:5000`
serve("127.0.0.1", 5000):
  var posts = %*[
    {
      "title": "Hello",
      "text": "world"
    }, {
      "title": "Bye",
      "text": ":("
    }, {
      "title": "Perfect nim web framework?",
      "text": "it's HappyX 🍍"
    },
  ]

  # on GET HTTP method at 127.0.0.1:5000/hello-world
  get "/hello-world":
    # We'll see "Hello, world!"
    "Hello, world!"
```

And import `posts` into `main`:
```nim
import
  # This will import HappyX framework
  happyx,
  ./mounts/[posts]
```

Write in `mounts/posts.nim`:
```nim
# Request model AddPost
# with two string fields
model AddPost:
  title: string
  text: string


mount Posts:
  # on GET HTTP method at 127.0.0.1:5000/posts
  get "/":
    # will responds all posts
    return posts
  
  # on GET HTTP method at 127.0.0.1:5000/post
  get "/$index:int":  # index is post index
    if posts.len > index:
      # try open 127.0.0.1:5000/post0
      return posts[index]
    else:
      # try open 127.0.0.1:5000/post10
      return {
        "error": "post index is wrong"
      }
  
  # on POST HTTP method at 127.0.0.1:5000/post/
  post "/[postData:AddPost]":
    posts.add(%*{
      "title": postData.title,
      "text": postData.text
    })
    return {"response": {
      "index": posts.len - 1
    }}
```

And mount it:
```nim
  ...

  mount "/posts" -> Posts

  # on GET HTTP method at 127.0.0.1:5000/hello-world
  get "/hello-world":
    # We'll see "Hello, world!"
    "Hello, world!"
```

Now see
GET `http://127.0.0.1:5000/posts/`
GET `http://127.0.0.1:5000/posts/1`
POST `http://127.0.0.1:5000/posts/`

[Source code](https://github.com/HapticX/happyx-tutorial-series/tree/91224af9718e44ce321a24298eca594c9b38046d)
A Comprehensive Overview of the Python PostgreSQL Library
Tags: python, postgres, apacheage, intern
Published: 2023-06-23 22:55:59

## Introduction

The interaction between programming languages and databases is crucial in the development of modern applications. Python, one of the most popular programming languages, offers various libraries to facilitate the connection and manipulation of relational databases. In this article, we will explore the Python library for PostgreSQL, a powerful tool that allows developers to interact with the PostgreSQL database efficiently and flexibly.

## What is the Python PostgreSQL Library?

The Python PostgreSQL library, also known as "psycopg2," is a Python extension designed to communicate with the PostgreSQL database. It provides an easy-to-use API for performing queries, updates, and other database-related operations. With psycopg2, developers can make the most of PostgreSQL's capabilities in their Python applications.

## Features and Benefits:

1. Database connection: psycopg2 allows establishing a direct and secure connection to the PostgreSQL database. With just a few lines of code, developers can connect to a local or remote database, authenticate, and initiate the interaction with the database.

2. Query execution: The library offers methods for executing SQL queries easily and efficiently. Developers can write complex queries using standard SQL syntax and then execute them through psycopg2. Furthermore, it is possible to retrieve query results in various formats such as lists, dictionaries, or custom objects.

3. Transaction management: psycopg2 supports transactions, enabling developers to perform batch operations and ensure data integrity. It is possible to start a transaction, execute multiple queries, and then commit or rollback the changes made to the database, providing a safe and consistent approach.

4. SQL injection prevention: The library has built-in features to prevent SQL injection attacks. It offers character escaping and parameter substitution mechanisms, ensuring that queries are executed securely without compromising the database's security.

5. Advanced data type support: PostgreSQL is known for its wide range of data types, including arrays, JSON, spatial geometry, and more. psycopg2 allows developers to work with these advanced data types, making it easier to manipulate and store complex information.

## Conclusion:
The Python PostgreSQL library (psycopg2) is an essential tool for developers who want to create robust and scalable Python applications with PostgreSQL database support. Its ease of use, advanced features, and built-in security make it a popular choice among developers.

With psycopg2, developers can make the most of PostgreSQL's features, from executing simple queries to handling advanced data types.
📋🔍 Checklist: A chave para uma atividade repetitiva bem-sucedida! 🔍📋
Tags: flutter, dart, googleplay, mobile
Published: 2023-06-23 22:30:10

Você já teve aquela sensação de que algo importante foi esquecido durante uma atividade repetitiva? Não se preocupe, você não está sozinho! É comum nos envolvermos em tarefas rotineiras e deixarmos passar pequenos detalhes que podem fazer toda a diferença.

Mas hoje, quero compartilhar com você a importância de fazer um checklist! 📝✅ Um simples documento que pode ajudá-lo a manter o controle e a organização durante atividades repetitivas, como o deploy de um aplicativo na Google Play.

Para ilustrar isso, confira este guia prático sobre como fazer o deploy de um app em Flutter na Google Play: [Link do guia](https://gist.github.com/robsonamendonca/7e56df843517785ba962ceafee67e29c#file-deploy-to-google-app-store).

Aqui estão algumas vantagens de usar um checklist:
✅ Evitar esquecimentos: Um checklist é uma lista de verificação que garante que todos os passos necessários sejam cumpridos, reduzindo as chances de esquecer algo importante.
✅ Economizar tempo: Com um checklist, você pode realizar suas tarefas de forma mais eficiente, economizando tempo ao seguir um roteiro pré-definido.
✅ Padronização: Ao criar um checklist, você estabelece um padrão para suas atividades repetitivas, garantindo consistência e qualidade em cada execução.

Então, da próxima vez que você precisar fazer um deploy de um app na Google Play ou realizar qualquer outra atividade repetitiva, lembre-se de criar um checklist! Dê uma olhada no guia que mencionei acima e comece a desfrutar dos benefícios dessa prática simples, mas poderosa.

Compartilhe este post com seus amigos, colegas de trabalho e equipe para que eles também possam aproveitar os benefícios de um checklist! 📤💻

#Checklist #Produtividade #Organização #AtividadesRepetitivas #AppDeployment #GooglePlay
5 GitHub Projects to Help You Become a Better DevOps Engineer ⚡
Tags: github, devops, sre
Published: 2023-06-23 22:30:02

**DevOps** is one of the most difficult industries to work in, and in order to stay relevant, you must continually learn.


So, today, I'd want to present **five incredible GitHub projects** that can help you become a better DevOps engineer. 

These 5 Github projects can be useful for anyone wishing to learn and looking for helpful resources to get started. 🏊‍♀️


 🏊‍♀️So, let us begin.⭐

## 1. <a href="https://github.com/upgundecha/howtheysre" target="_blank">How they SRE</a>
> ⭐ **Github stars: 4.8k**

This repository is a selected collection of publicly available resources on how technology and tech-savvy organisations worldwide practise Site Reliability Engineering (SRE).

## 2. <a href="https://github.com/binhnguyennus/awesome-scalability" target="_blank">Awesome Scalability</a>
> ⭐ **Github stars: 32.5k**

This repository has a well-organized reading list that demonstrates the patterns of scalable, dependable, and performant large-scale systems. This is one of the best scalability resources, containing real-world examples from huge organisations.

## 3. <a href="https://github.com/bregman-arie/devops-exercises" target="_blank">DevOps Exercises</a>
> ⭐ **Github stars: 8.6k**

This repository offers questions and exercises on technical DevOps and SRE topics.

## 4. <a href="https://github.com/trimstray/test-your-sysadmin-skills" target="_blank">Test your sysadmin skills</a>
> ⭐ **Github stars: 7.2k**

This project includes test questions and answers for occupations such as Linux System Administrator.

## 5. <a href="https://github.com/dastergon/awesome-sre" target="_blank">Awesome Site Reliability Engineering</a>
> ⭐ **Github stars: 6.5k**

This repo contains a curated set of outstanding Site Reliability and Production Engineering resources. 🏊‍♀️

---

I hope you found this list interesting. I plan to create more fantastic resources in the near future. So keep an eye out!
You Are What You Build: Making Your Code More Human
Tags: programming, ai, github, podcast
Published: 2023-06-23 22:12:21

The world is what we make it. Tech - and AI - follow the same principles. 

On this week’s episode of Dev Interrupted, we sit down with Christina Enchevta, a Director of Engineering at GitHub, to unravel the link between the values we hold and the things we build. We delve into how AI applications mirror our values, intentionally or not, and how this can lead to surprising outcomes, no matter how benevolent our intentions.

Christina also shares practical advice for engineering leaders on how to take and provide constructive feedback, dismantle information silos, and infuse your values into the product development process.

>“If you’re going to do AI, know the history, know how it works, and pursue it with a diverse group of people.”

{% spotify spotify:episode:3S7ieud0YF1UdwB4txU3OA %}

## Episode Highlights:
* (0:00) [Accelerate State of DevOps survey](http://bit.ly/2023SODRSponsors)
* (1:27) GitHub's secret sauce
* (5:05) Being transparent with your dev team
* (11:30) Providing constructive feedback
* (17:45) Generative AI & art
* (22:40) Dismantling information silos
* (26:50) What devs should be excited about

[Read the full episode transcript
](https://devinterrupted.com/podcast/you-are-what-you-build-making-your-code-more-human/)

---

***While you’re here, check out this video from our [YouTube channel](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1), and be sure to like and [subscribe](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1) when you do!***

{% youtube MFY2kzZrEvw %}

---

## A 3-part Summer Workshop Series for Engineering Executives
Engineering executives, [register now](https://linearb.io/events/2023-summer-series/?utm_source=Dev.to&utm_medium=referral&utm_campaign=202306%20-%20Event%20-%20Summer%20Series%20-%20Podcast%20Distribution) for LinearB's 3-part workshop series designed to improve your team's business outcomes. Learn the three essential steps used by elite software engineering organizations to decrease cycle time by 47% on average and deliver better results: Benchmark, Automate, and Improve.

Don't miss this opportunity to take your team to the next level - [save your seat today](https://linearb.io/events/2023-summer-series/?utm_source=Dev.to&utm_medium=referral&utm_campaign=202306%20-%20Event%20-%20Summer%20Series%20-%20Podcast%20Distribution).

[![Register Today](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nd6b3egikvnssdi9x50g.png)](https://linearb.io/events/2023-summer-series/?utm_source=Dev.to&utm_medium=referral&utm_campaign=202306%20-%20Event%20-%20Summer%20Series%20-%20Podcast%20Distribution)
JavaScript : The fundamentals
Tags: javascript, basicsjavascript, beginners
Published: 2023-06-23 21:56:48

**01. Variables**
Variables are a way to store data for later use. In JavaScript, you can declare a variable in three ways.

Using **var**, **let**, and **const**.

**Var**, **let** and **const** have their different use cases. Here’s a quick overview:

**Var**: var is the old way of declaring a variable. It is compatible with all the older browsers.

**Let** **and const**: these were introduced in 2015. If you want to change the value of the variable use Let. And if you don’t want to change the value use Const.

**02. Data Types.**

Every data in javaScript has a type. For example, a number is a number type and a text is a string type.

There are 8 data types in JavaScript:

**1.String:** Represent text-based data.
**2.Number:** Represent Numbers. An integer or a floating-point number.
**3.BigInt:** Represents arbitrary length of integer.
**4.Boolean:** True or False value
**5.Undefined:** Value of data whose value is not assigned yet.
**6.Null:** Represents unknown values.
**7.Symbol:** Represents unique and immutable values.
**8.Object:** Key-value pairs of data