10 JavaScript topics that you should know.

if (true) {
// execute something
}
for( i = 0; i < 5 ; i++) {
// execute something
}
let a = 5;
console.log(a); // 5
a = 6;
console.log(a); // 6
const b = 5;
console.log(b); // 5
b = 6; // It will throw an error.
const compare1 = ( 18 == '18');
console.log(compare1); // true
const compare2 = (18 === '18');
console.log(compare2); // false
const product = {
name: 'Camera',
for: 'Roky'
};
console.log(product.name);
const product = {
name: 'Camera',
for: 'Roky'
};
console.log(product['name']);
parseInt('Hello World', 10); // NaN
const a = NaN + 5;
console.log(a); // NaN
a = NaN;
console.log(iSNaN(a)) // true
console.log(isNaN(5) // false
console.log(isNaN('I love Bangladesh')) // true
const cat = 'Mini';
cat.charAt(1) // i
const a = '3' + 4 + 5;
console.log(a); // '345'
const b = 4 + 5 + '5';
console.log(b) // '95'
let people = ['Roky', 'Tamim', 'Mushfiq'];
people.unshift('Shakib');
console.log(people); // ['Shakib', 'Roky', 'Tamim', 'Mushfiq']
const array = [4, 3, 8, 7];
console.log(array[array.length - 1]) // 7
const a = Math.floor(Math.random() * 10) + 1;
console.log(a); // a random number from 1 to 10
var fruits = [4, 3, 8, 7];
fruits.sort();
console.log(fruits) // 3, 4, 7, 8

--

--

--

I am an enthusiastic JavaScript developer with knowing some framework for the frontend and the backend.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

YouTube Video | Create Line Through Effect in JavaScript

JavaScript for Noobs Pt. 1: Variables and Data Types.

Stop using nested ternary operators. Here’s why.

YouTube Video | Create App Using Unsplash API In ReactJS — 2

An Introduction to performance.now()

a clock in a pink and green background

React.js

Uploading an Image to Firebase Cloud Storage and returning URL with Express / Nodejs

Optimize your Website like a pro

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Roky Das

Roky Das

I am an enthusiastic JavaScript developer with knowing some framework for the frontend and the backend.

More from Medium

How to print the number of years and months and the total number of days between dates without…

What are JavaScript EventListeners and how do they work?

JavaScript , GIT, NOSQL

Phase 1 and How I Found About APIs the Hard Way