Implement the function isShortWord(s).

It should take a string and return true if the string meets both of the following conditions:

  1. The length of the string is less than 10 characters.
  2. The string consists of a single word (doesn’t have spaces in it)
    Otherwise, it should return false

Take a note of how we pass the function isShortWord into a filter function.
We’re not calling isShortWord immediately, it will happen inside of the filter.

This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task

functions.js

export const isShortWord = (s) => {
  return true;
}

solution.js

/**
 * Implement the function `isShortWord(s)`.
 * */

import { isShortWord } from './functions.js';

const words = [ 'good', 'things', 'happen', 'if', 'you', 'do', 'something good', 'for_a_long_time' ];
const shortWords = words.filter(isShortWord);

console.log(shortWords);    // [ 'good', 'things', 'happen', 'if', 'you', 'do' ]