Answered You can hire a professional tutor to get the answer.
How do I solve this function in Javascript?
How do I solve this function in Javascript?
// 1) howSwedish
// ABBA is a band, they have many songs including Dancing Queen, and
// Fernando. ABBA is actually a Swedish band, so if we wanted to find
// out howSwedish a String is, we could simply find out how many times
// the String contains the substring "abba". We want to look for this
// substring in a case insensitive manner. So "abba" counts, and so
// does "aBbA". We also want to check for overlapping abba's such as
// in the String "abbAbba" that contains "abba" twice.
//
// howSwedish("AbBa a b b a") returns 1
// howSwedish("abbabba!") returns 2
function howSwedish(str) {
// TODO: this method
// Use str.length()
// Use + for concatenation
// Use var to declare variables
return 0;
}
// The following asserts will fail until howSwedish is fixed
// console.assert ( 0 == howSwedish ( 'no' ) );
// console.assert ( 1 == howSwedish ( 'axxc AbBa Xx' ) );