task6/script.js
// Given a note, calculates its duration in sixteenths
Given a note, calculates its duration in sixteenths
Given a note calculates its duration in sixteenths
function calculateNoteDurationInSixteenth(note) {
	let noteDuration = note.duration.replace('r', '');
	let noteDurationInSixteenth = (16 / parseInt(noteDuration));
	if (note.isDotted) {
		noteDurationInSixteenth += noteDurationInSixteenth / 2;
	}
  return noteDurationInSixteenth;
}
function calculateNoteDurationInSixteenth ( note ) { let noteDuration = note . duration . replace ( 'r' , '' ) ; let noteDurationInSixteenth = ( 16 / parseInt ( noteDuration ) ) ; if ( note . isDotted ) { noteDurationInSixteenth += noteDurationInSixteenth / 2 ; } return noteDurationInSixteenth ; }
Given a note, calculates its duration in sixteenths
Given a note calculates its duration in sixteenths
// Remove r if is a rest // Calculate the duration of the notes in 16th // If dotted increase value respectively