This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const array2D = [ | |
| [1, 2, 3], | |
| [4, 5, 6], | |
| [7, 8, 9], | |
| ]; | |
| for (let cols = 0; cols < array2D.length; cols++) { | |
| for (let rows = 0; rows < array2D[cols].length; rows++) { | |
| const element = array2D[cols][rows]; | |
| console.log(element); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { google } = require("googleapis"); | |
| const auth = new google.auth.GoogleAuth({ | |
| keyFile: "credentials.json", | |
| scopes: "https://www.googleapis.com/auth/spreadsheets", | |
| }); | |
| const main = async () => { | |
| const client = await auth.getClient(); | |
| const googleSheets = google.sheets({ version: "v4", auth: client }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // npm install xlsx | |
| const xlsx = require("xlsx"); | |
| const file = xlsx.readFile("./data.xlsx"); | |
| let data = []; | |
| let sheets = file.SheetNames; // ["Hoja1", "Hoja2"]; | |
| for (let index = 0; index < sheets.length; index++) { | |
| const jsonSheet = xlsx.utils.sheet_to_json(file.Sheets[sheets[index]]); | |
| data.push(jsonSheet); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| fs.readFile("./text.txt", "utf8", (err, data) => { | |
| if (err) throw err; | |
| const arr = data.toString().replace(/\r\n/g, "\n").split("\n"); | |
| arr.forEach((item, index) => { | |
| console.log(`Line ${index + 1} - Item: ${item}`); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| const data = fs.readFileSync("./text.txt", { encoding: "utf-8", flag: "r" }); | |
| const arr = data.toString().replace(/\r\n/g, "\n").split("\n"); | |
| console.log(arr); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| const arr = ["JBKR23", "TN9728"]; | |
| fs.writeFileSync("./text_copy.txt", arr.join("\n")); | |
| //JBKR23 | |
| //TN9728 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const factorial = (num) => { | |
| if (num <= 1) { | |
| return 1; | |
| } | |
| return num * factorial(num - 1); | |
| } | |
| console.log(factorial(5)); // 120 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const randomNumber = (until) => { | |
| return Math.floor(Math.random() * until); | |
| }; | |
| console.log(randomNumber(20)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function countdown(n){ | |
| if(n < 1){ | |
| return [] | |
| } | |
| const countArray = countdown(n - 1); | |
| countArray.unshift(n) | |
| return countArray; | |
| } | |
| console.log(countdown(5)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| openapi: "3.0.2" | |
| info: | |
| title: API docs | |
| version: "1.0" | |
| servers: | |
| - url: https:ma-autored | |
| paths: | |
| /v1.0/paises/CL/vehiculo/{patente}: | |
| get: | |
| tags: |
OlderNewer