This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let names = ['Rahul','Rohit','Rohan'] | |
function addNewName(name){ | |
setTimeout(function(){ | |
names.push(name) | |
},5000) | |
} | |
function printNames(){ | |
setTimeout(function(){ | |
console.log(names) | |
},3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sayHello(){ | |
let name = 'Rahul' | |
function inner(){ | |
console.log(`Hello ${name}`) | |
} | |
return inner | |
} | |
let abc = sayHello() | |
console.log(abc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum(x){ | |
return function(y){ | |
return function(z){ | |
return x + y + z | |
} | |
} | |
} | |
console.log(sum(10)(20)(30)) | |
// Output: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum(x, y, z){ | |
return x + y + z | |
} | |
console.log(sum(10, 20, 30)) | |
// Output: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const outerFunc = () => { | |
console.log("Outer Function") | |
const innerFunc = () =>{ | |
console.log("Inner Function") | |
} | |
return innerFunc | |
} | |
outerFunc()() | |
// OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myFunc = (greetings,name) => `${greetings()}, ${name}! `; | |
const hello = () => "Hello" | |
const bonjour = () => "Bonjour" | |
const salut = () => "Salut" | |
const result_1 = myFunc(hello,"Rahul"); | |
const result_2 = myFunc(bonjour,"Rahul"); | |
const result_3 = myFunc(salut,"Rahul"); | |
console.log(result_1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myFunc = name => `Hello, ${name}! `; | |
const result = myFunc("Rahul"); | |
console.log(result); | |
// Output: Hello, Rahul! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"redirect": { | |
"uri": "https://TwilioAIPhoneServiceAI.rahulbanerjee26.repl.co/user", | |
"method": "POST", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"redirect": { | |
"uri": f'{api_url}/user', | |
"method": "POST" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else: | |
postData = json.loads(request.form['Memory']) | |
postData = postData['twilio']['collected_data']['user_information']['answers'] | |
name = postData['user_name']['answer'] | |
phoneNumber = postData['user_phone_number']['answer'] | |
db[name] = phoneNumber | |
return { | |
"actions": [{ | |
"say": f"Thank You, {name}! Your info has been saved in the repl db" | |
}] |