Refactor the code:
var name = "Francis";
var lastname = "Jones"
var age = 23;
var obj
function createObject(name,lastname,age){
obj = {
import express from "express"; | |
import { PrismaClient } from "@prisma/client"; | |
import { hash, compare } from "bcrypt"; | |
import jwt from "jsonwebtoken"; | |
const prisma = new PrismaClient(); | |
const app = express(); | |
app.use(express.json()); |
class Todo { | |
constructor(text, finished) { | |
this.id = String(Date.now()); | |
this.text = text; | |
this.finished = finished; | |
} | |
} | |
class InputDOM { | |
constructor() { |
// Name, email, phone, location, age, picture | |
// Events listener: click (generate user) | |
const btnTag = document.querySelector("#generate"); | |
function fetchUser() { | |
fetch("https://randomuser.me/api") | |
.then((response) => response.json()) | |
.then((data) => { | |
const randomUser = data.results[0]; |
let randomUser; | |
fetch("https://randomuser.me/api") | |
.then((response) => { | |
return response.json(); | |
}) | |
.then((data) => { | |
randomUser = data.results[0]; | |
console.log(randomUser); |
const itemForm = document.getElementById("item-form"); | |
const itemInput = document.getElementById("item-input"); | |
const itemList = document.getElementById("item-list"); | |
const clearBtn = document.getElementById("clear"); | |
const filterInput = document.getElementById("filter"); | |
const liInItems = document.querySelectorAll(".items > li"); | |
function createElement(tag, className, text) { | |
const elm = document.createElement(tag); |
const express = require("express"); | |
// Create express instance | |
const app = express(); | |
// accept json data | |
app.use(express.json()); | |
// Http Method | |
/** |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<title>Grand Hotel</title> | |
<link rel="shortcut icon" type="image/png" href="img/crown.png" /> | |
<link | |
rel="stylesheet" |
import { useState } from "react"; | |
import Categories from "./Categories"; | |
import Menus from "./Menus"; | |
const menu = [ | |
{ | |
id: 1, | |
title: "buttermilk pancakes", | |
category: "breakfast", | |
price: 15.99, |
/* *-*-*-*-*-*-*-*-*-*-* Challenge 1 ------------------ | |
Create a variable with the type number and assign it an arbitrary value | |
*/ | |
// ---------------------------------------------------- | |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- | |
// ---------------------------------------------------- | |
/* *-*-*-*-*-*-*-*-*-*-* Challenge 2 ------------------ | |
Create a variable with the type string and use the addition operator to put two arbitrary words together | |
*/ |