base js functional