Skip to content

Instantly share code, notes, and snippets.

View jochri3's full-sized avatar

Christian Lisangola jochri3

View GitHub Profile
@jochri3
jochri3 / H7HZ-49.js
Created September 3, 2017 17:05
null created by ChrisLis - https://repl.it/H7HZ/49
// Write a method that takes in a string. Return the longest word in
// the string. You may assume that the string contains only letters and
// spaces.
//
// You may use the String `split` method to aid you in your quest.
//
// Difficulty: easy.
function longest_word(sentence) {
var phrase=sentence.split(" ")
@jochri3
jochri3 / HaJO-61.js
Created September 3, 2017 16:29
null created by ChrisLis - https://repl.it/HaJO/61
// Write a function that takes an integer `n` in; it should return
// n*(n-1)*(n-2)*...*2*1. Assume n >= 0.
//
// As a special case, `factorial(0) == 1`.
//
// Difficulty: easy.
function factorial(n) {
var fact=1
if(n==0)
@jochri3
jochri3 / HaJU-46.js
Created September 3, 2017 16:24
null created by anonymous - https://repl.it/HaJU/46
// Write a function that will take a string as input, and return a new
// string with the same letters in reverse order.
//
//
// Difficulty: easy.
function reverse(string) {
var reversed=""
for(var i=string.length-1;i>=0;i--)
{