Browse Source

for loop

master
Steven Vda 2 years ago
parent
commit
6de8d657e0
3 changed files with 83 additions and 0 deletions
  1. 51
    0
      3_strings.js
  2. 31
    0
      arrays.js
  3. 1
    0
      booleans-and-conditionals.js

+ 51
- 0
3_strings.js View File

@@ -0,0 +1,51 @@
let num = 1001;
let dec = 123.45;

console.log(num.toString().length);
console.log(dec.toString().length);

let numb = 1.2;

if (numb.toString().includes('.')) {
console.log('It\'s a decimal.')
} else {
console.log('It\s a number.')
}

let dna = " TCG-TAC-gaC-TAC-CGT-CAG-ACT-TAa-CcA-GTC-cAt-AGA-GCT ";
/*let up = dna.trim();
console.log(up.toUpperCase());*/
dna = dna.trim().toUpperCase();
console.log(dna);

dna = dna.replace('GCT', 'AGG');
console.log(dna);

if (dna.includes('CAT')) {
console.log('CAT found');
}
else {
console.log('CAT NOT found');
}

let codon = dna.slice(16, 19);

console.log(codon);

//console.log('The DNA strand is ' + dna.length + ' characters long');

console.log(`The DNA strand is ${dna.length} characters long`);

let name = 'JavaScript';

/*let abbreviation = name.slice(0,1) + name.slice(4,5);

console.log(abbreviation);*/

let abbreviation = name.replace('ava', '').replace('cript', '');

console.log(abbreviation);





+ 31
- 0
arrays.js View File

@@ -0,0 +1,31 @@
let dingen = ['JavaScript', 10, null, [1, 2], { naam: "Nart" }, true];

console.log(dingen[0]);

let coolName = 'JavaScript';

console.log(coolName[0]);

let practiceFile = [273.15];

practiceFile.push(42); //push zet achteraan 42 erbij
practiceFile.push('Hello');
practiceFile.push(false, -4.6, "87");

console.log(practiceFile);

let cargoHold = ['oxygen tanks', 'space suits', 'parrot', 'instruction manual', 'meal packs', 'slinky', 'security blanket'];

/*cargoHold[5] = 'Space tether';

let element = cargoHold.pop();

cargoHold.unshift(1138);

console.log(cargoHold);
console.log(element);*/






+ 1
- 0
booleans-and-conditionals.js View File

@@ -50,3 +50,4 @@ else {
}




Loading…
Cancel
Save