Javascript Code Samples



Filters


Create webserver using expressjs
harika | 5 years, 2 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 | 6 years, 5 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 | 6 years, 5 months
//Fill
javascript
Extract files synchronously in javascript
harika | 6 years
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 | 6 years, 5 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 | 6 years, 5 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 | 5 years, 2 months
//add.js
const add = (p1, p2, callback) => {
setTimeout(()=>{
try to run the file with node Ex: node add.js
nodejs javascript async
https requests and callbacks in nodejs
harika | 5 years, 2 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
Write a basic promise in nodejs
harika | 5 years, 2 months
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs async javascript
Find Documents in Mongo db using Node JS
kishore_kumar | 5 years, 7 months
const mongodb = require("mongodb")
const mongo_client = mongodb.MongoClient

javascript node js mongodb
Prev Next