Home > Web Front-end > JS Tutorial > Basic Javascript using VSCode

Basic Javascript using VSCode

Barbara Streisand
Release: 2024-12-27 22:02:11
Original
207 people have browsed it

Javascript básico usando VSCode

Hello everyone, I started studying javascript and I separated some things that I managed to do:

let school = "Javascript School";
let fullPackage = "JS Pro";
let projects = 4;
let awesome = false;


console.log(school, fullPackage, projects, awesome);

Copy after login

the one below serves to show the types:

let nome;
nome = "Eva"
console.log(typeof(nome)); // 'string'
nome = 123
console.log(typeof(nome)); // 'number'
nome = {}
console.log(typeof(nome)); // 'object'

Copy after login

string size:

let s1 = "Melancia";
console.log("Length de s1 = " + s1.length);



Copy after login

accessing each character:

let s1 = "Abacaxi";
console.log(s1[0], s1[1], s1[2], s1[3], s1[4], s1[5], s1[6]);

Copy after login

put everything in capital letters:

let s1 = "Melancia";
console.log(s1.toUpperCase());

Copy after login

remove spaces at the beginning of the string:

let s1 = "      Melancia";
console.log(s1.trimStart());

Copy after login

replace the word:

let s1 = "Melancia";
console.log(s1.replace("Melancia", "Melão"));
Copy after login

split strings into substrings:

let s1 = "Melancia é incrível";
console.log(s1.split(" "));

Copy after login

put dashes in the spaces:

let s1 = "Melancia é incrível";
console.log(s1.split(" ").join("-"));

Copy after login

Check if the sentence contains something:

let s1 = "Melancia é incrível";
console.log(s1.includes("Mel"));
Copy after login

That's it guys, I know it's simple but I thought this string manipulation was cool :)

The above is the detailed content of Basic Javascript using VSCode. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template