NEWNew questions added!Explore now
Vài bài JavaScript cơ bản để luyện tay - viết code, chạy thử ngay trong trình duyệt rồi đối chiếu đáp án mẫu.
Write mergeSorted(a, b) merging two sorted arrays into one sorted array, without sort()
Write mostFrequentChar(str) returning the most frequent character (null for an empty string)
Write isAnagram(a, b) checking whether two strings are anagrams (ignoring case and spaces)
Write twoSum(nums, target) returning the indices of the two numbers adding up to target (empty array if none)
Write groupByLength(words) that groups an array of strings into an object keyed by length
Write flatten(arr) that flattens a nested array at any depth
Write chunk(arr, size) that splits an array into groups of size
Write titleCase(str) that uppercases the first letter of every word and lowercases the rest
Write fizzBuzz(n) returning the FizzBuzz sequence from 1 to n as an array of strings
Write countVowels(str) that counts the vowels in a string