Coder Social home page Coder Social logo

ez-js's Introduction

ezJS

A simple guide to JS basics

Copy and modify

Table of contents

Installations

(IDE etc.)

Examples: VSCode, Notepad++ or regular notepad

Web browser like Google Chrome or Mozilla Firefox

Setup

Create HTML file

In VSCode, you can just write ! and it will autofill the setup for a html file.

If you don't use VSCode or it does not work, you can copy this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>

Create javascript file

You can create a javascript file in many ways. You can for example create any type of file in your folder/working directory and end it with .js. This can easily be done in VSCode where you can clearly see the file extention (what the file ends with after .).

Link javascript file

<body>
   <script src="filename.js"> 
</body>

View your code

Open the console by either pressing f12 while in the browser or opening though right-clicking and choosing "show console".

Commenting

For commenting on a single line:

//

Example:

// hello

For commenting on multiple lines:

Start with:

\*

End with:

*/

Example:

/* asf
hello
world
*/

Variables

Create variable with var or let and the name of the variable.

var a = 1;

Call upon the variable by just using its name.

a
>>> 1 

Change the value of the variable by calling upon it and appointing it a new value with =

a = 2;

Create constant with const:

const pi = 3.14;

Some types: number, string and bolean:

let numb = 0;

let str = 'abc';

let bool = false;

Arrays

Arrays are a list of elements. These elements can be any of any type and can be mixed in the array. Arrays can be created to have a fixed lenth or an dynamic length.

A fixed length array is created with const.

const b = ['a', 'hey', 2, '๐ŸŽ'];

A dynamic array is created with var or let.

let c = [2, 3];

ez-js's People

Contributors

mnbvmnbv2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.