Javascript Code Samples



Filters


Create webserver using expressjs
harika | 4 years, 8 months
//server.js
const express = require("express")
const app = express()
Prerequisites : express suppose to be installed If not try npm i express inside the project folde
nodejs route javascript
display state inside any html tag
harika | 5 years, 11 months
import React from 'react'
export default class StateProps extends React.Component {

Whatever html tag it is just wrap it inside curly braces ({}) as a value.
javascript react js
XHR Request & Ajax Request
harika | 5 years, 10 months
//Fill
javascript
Extract files synchronously in javascript
harika | 5 years, 6 months
const tar = require('tar');
  tar.x(
    {
Try to install tar module using npm and then try. Happy Coding :-)
node js javascript react js
Work with inline styles in React js
harika | 5 years, 11 months
//plugin to any test js file and proceed :-)
//This is the best standard to work with inline styles
javascript react js css
JQuery toggle functionality in react
harika | 5 years, 11 months
import React from 'react'
export default class ToggleComponent extends React.Component{
  construc
you can enable or disable any component using ternary operator with state Suggestions : this works
javascript react js
How to use callbacks in node js
harika | 4 years, 8 months
//add.js
const add = (p1, p2, callback) => {
setTimeout(()=>{
try to run the file with node Ex: node add.js
nodejs javascript async
Write a basic promise in nodejs
harika | 4 years, 8 months
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs async javascript
https requests and callbacks in nodejs
harika | 4 years, 8 months
//ex.js
const https = require('https')
const url = "" //Use the url you want to get the data from
try to run the file with the help of node node ex.js
nodejs callback javascript
Find Documents in Mongo db using Node JS
kishore_kumar | 5 years, 1 month
const mongodb = require("mongodb")
const mongo_client = mongodb.MongoClient

javascript node js mongodb
Prev Next