“.js” Respostas de código

JavaScript

let str = "12345.00";
str = str.substring(0, str.length - 1);
Bored Bison

JavaScript

  coursesRouter.get('/:id',expressAsyncHandler(async(req,res)=>{
    const pageSize = 1;
    const page = Number(req.query.pageNumber) || 1;
    const courseId = req.params.id;
    const course =    await db('id').from('courses').where('id','=',courseId)
    const courseName = course[0].name
    const sections = await db('course_name').from('sections').where('course_name','=',courseName).limit(pageSize).offset(pageSize * (page - 1))
    const count = await db('course_name').from('sections').count('sections')
    console.log( Math.ceil( count[0]/pageSize));
    res.send({sections , page, pages: Math.ceil( count[0]/pageSize)})
})) 
Thoughtful Termite

? JavaScript

?? (The Nullish Coalescing Operator)

const foo = null ?? 'default string';
console.log(foo);
// expected output: "default string"

const baz = 0 ?? 42;
console.log(baz);
// expected output: 0
Silly Skunk

.js

const ranking = (arr, compFn) =>
  arr.map(a => arr.filter(b => compFn(a, b)).length + 1);
Red Team

JavaScripts

   NGGFNENg
                
Smoggy Sloth

JavaScript

  coursesRouter.get('/:id',expressAsyncHandler(async(req,res)=>{
    const pageSize = 1;
    const page = Number(req.query.pageNumber) || 1;
    const courseId = req.params.id;
    const course =    await db('id').from('courses').where('id','=',courseId)
    const courseName = course[0].name
    const sections = await db('course_name').from('sections').where('course_name','=',courseName).limit(pageSize)
    .offset(pageSize * (page - 1))
    const count = await db('course_name').from('sections').count('sections')
    console.log( Math.ceil( count[0]/pageSize));
    res.send({sections , page, pages: Math.ceil( count[0]/pageSize)})
})) 
Thoughtful Termite

Respostas semelhantes a “.js”

Procure respostas de código populares por idioma

Procurar outros idiomas de código