You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exercise_3.js 875B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. let num = 1601;
  2. if (String(num).includes('.')) {
  3. console.log(String(num).length - 1);
  4. }
  5. else {
  6. console.log(String(num).length);
  7. }
  8. let dna = " TCG-TAC-gaC-TAC-CGT-CAG-ACT-TAa-CcA-GTC-cAt-AGA-GCT ";
  9. dna = dna.trim().toUpperCase().replace('GCT', 'AGG');
  10. if (dna.indexOf('CAT')) {
  11. console.log('CAT FOUND');
  12. } else {
  13. console.log('CAT NOT FOUND');
  14. }
  15. let seq = dna.slice(16, 19);
  16. console.log(dna);
  17. console.log(`The DNA strand is ${dna.length} characters long.`);
  18. console.log(`${dna.slice(4, 7).toLowerCase()}o ${dna.slice(40, 43).toLowerCase()}`);
  19. let lang = 'JavaScript';
  20. console.log(lang.slice(0, 1) + lang.slice(4, 5));
  21. console.log(lang.replace('ava', '').replace('cript', ''));
  22. console.log(`The abbreviation for 'JavaScript' is '${lang.slice(0, 1) + lang.slice(4, 5)}'.`);
  23. let title = "title case".replace('t', 'T').replace('c', 'C');
  24. console.log(title);