blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 3 236 | src_encoding stringclasses 29
values | length_bytes int64 8 7.94M | score float64 2.52 5.72 | int_score int64 3 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 8 7.94M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
34a005eeb64bc0f037835b2816fcb3cf0e5ce4db | JavaScript | HibaADJ/TP- | /TPs_js/EXO objet/TP26/TP26.js | UTF-8 | 3,831 | 3.1875 | 3 | [] | no_license | const nomInput = document.querySelector("#nom");
const prenomInput = document.querySelector("#prenom");
const ageInput = document.querySelector("#age");
const genreInput = document.querySelector("#genre");
const paysInput = document.querySelector("#pays");
const optionInput = document.querySelector("#option");
const li... | true |
0cc969b734f46e64efcf5adabdfd548d2c6b5ed6 | JavaScript | jps725/zoigl | /frontend/src/store/images.js | UTF-8 | 2,418 | 2.59375 | 3 | [] | no_license | import { csrfFetch } from "./csrf";
const LOAD = "images/LOAD";
const ADD_ONE = "images/ADD_ONE";
const UPDATE_ONE = "images/UPDATE_ONE";
const REMOVE_ONE = "images/REMOVE_ONE";
const loadImage = (image) => ({
type: LOAD,
image,
});
const addImage = (image) => ({
type: ADD_ONE,
image,
});
const editImage = ... | true |
088a5a8f603819854ab93a4286fe07d601975284 | JavaScript | freebebe/skyhand | /DOM/ag1/p2/ass/js/quanJu_var.js | UTF-8 | 180 | 2.90625 | 3 | [] | no_license | function ceShi(tak) {
var test = tak * tak; //没有var为全局
return test;
}
var test = 50;
var trying = ceShi(20); //ceShi(20*20)
alert(trying);
| true |
140c3e984cc199e725ada42c89930e18bb1e4110 | JavaScript | programmer-prashant/TQ_React_Assignments | /src/hooks/useContext_useCallback/ContextDemo.jsx | UTF-8 | 648 | 2.578125 | 3 | [] | no_license | // 2. Create a context and provide a value
// Provide the object as provider value
// Consume in the nested component using useContext
// 7.Create two context and provide a value ‘web_developer’ and
// ‘react’repectively
// 10. WAP to show use of UseContext hook for sharing a theme (e.g. color,
// paddings, margins, fo... | true |
f8310c1aa5ce1693c63af3a696dab3942db5051f | JavaScript | lucyj204/react-weather-app | /src/CitySearch.js | UTF-8 | 3,088 | 2.703125 | 3 | [] | no_license | import React, { useState, useRef } from "react";
import "./App.css";
import WeatherReport from "./WeatherReport";
import axios from "axios";
import Loader from "react-loader-spinner";
export default function CitySearch(props) {
const [weatherData, setWeatherData] = useState(null);
const [city, setCity] = useState(... | true |
7be2f41d564cd561f7cadf1823863d03a7b81e14 | JavaScript | keirahela/Discord-Suggest-Feedback-Bot | /commands/suggest.js | UTF-8 | 834 | 2.59375 | 3 | [] | no_license | const Discord = require('discord.js')
const { suggestId } = require('../data/channelIDs.json')
module.exports = {
name: "suggest",
description: "suggestion command (embed style)",
async run (bot, message, args) {
if(!args[0]) return message.reply('Please add a reason to suggestion!')
... | true |
cecf49da519f40ffb689a49e88571b6b020300c4 | JavaScript | ShellGoldfish0/HseAdventSappP7 | /advent.js | UTF-8 | 2,095 | 2.828125 | 3 | [] | no_license | console.log('Winter Break is almost here!!!');
let icons = [
'🛷',
'🌨',
'🐻',
'🌲',
'🎁',
'🤶',
'🧤',
'🧣',
'🥶',
'🌟',
'⛸',
'🍪',
'🦌',
'🏂',
... | true |
76f72ccf95454afa63f1f60b8c7f7ad203491f3e | JavaScript | openluck/Demo | /nodeDemo/爬虫/test2/test2.js | UTF-8 | 893 | 2.5625 | 3 | [] | no_license | /*
* @Descripttion:
* @version:
* @Author: OpenLcuk
* @Date: 2021-05-31 10:33:19
* @LastEditors: OpenLcuk
* @LastEditTime: 2021-05-31 10:35:49
*/
var http = require("http");
var https = require("https");
var fs = require("fs");
var cheerio = require("cheerio");
//保存网络图片
function saveImage(imageUrl) {
http.ge... | true |
7a764d39ff88ab4853db705bef8d96f3fe7b7e9e | JavaScript | zhenchai/mall | /mall_site/src/main/webapp/js_max/customer/goodcomm.js | UTF-8 | 941 | 2.875 | 3 | [
"MIT"
] | permissive | /**
*
*/
function checkComment (id){
if(! checkScore(id)){
return;
}
if(! checkContext(id)){
return;
}
$("#commForm"+id).submit();
}
function checkScore(id){
if(!$(".des li").hasClass("on")){
alert("请您给商品描述评分");
return false;
}
return true;
}
function checkContext(id){
var str = $("#complaincon"+... | true |
286f9427c0a98c9a68dcd507367b5e1f6aa4e8a6 | JavaScript | Nate1546/learning-p5-js | /lesson-3/ch-8-objects/exercise-8.5-simple-gravity-OOP/ball.js | UTF-8 | 466 | 3.4375 | 3 | [] | no_license | class Ball {
constructor(x, y, w) {
this.x = x;
this.y = y;
this.w = w;
this.speed = 0;
}
display() {
fill(255);
noStroke();
ellipseMode(CENTER);
ellipse(this.x, this.y, this.w, this.w);
}
move() {
// Add speed to y location
this.y += this.speed;
// Add gravity to speed
this.speed += gra... | true |
f9bc652ac97365dd7a0863c962b06a1fa30c7f0a | JavaScript | richard2018/es | /JavaScript王者归来 源代码/第21章 面向对象/example-21.39-bind方法.js | GB18030 | 672 | 3.40625 | 3 | [] | no_license | Function.prototype.bind = function(owner) //PrototypeʵֹƵbind
{
//ԭͬһһֻǻһʽ
var $fun = this;
return function(){
$fun.apply(owner, arguments);
}
}
//һfoo
var foo = {};
//bind(foo)foo.barõذΪfooĶΪ
//Ҳıthisõֵ
foo.bar = (function(){
alert(this == foo);
}).bind(foo);
//setTimeout첽foo.barһ£thisֵӦ... | true |
01706abdd396b5239da6f37977668ba72b90d446 | JavaScript | gerkenv/webpack-example | /js/module2.js | UTF-8 | 630 | 3.359375 | 3 | [] | no_license | // example module #2
var _ = require('lodash');
var people = [
{
"id": 1,
"gender": "male",
"age": 31
},
{
"id": 2,
"gender": "female",
"age": 32
},
{
"id": 3,
"gender": "male",
"age": 33
},
{
"id": 4,
"... | true |
1a07cc2fc0486b2318ee369336e9aa72bae8a8ea | JavaScript | hagitbu/Remez-finalProject | /pages/clue/static/js/clue.js | UTF-8 | 1,655 | 2.828125 | 3 | [] | no_license | //
//
//
// //
// // function tg(t){
// // t.fontWeight=t.fontWeight=="bold"?"normal":"bold";
// // t.textDecoration =t.textDecoration =="none"?"underline ":"none";
// //
// // }
//
//
// function clickLi(Pelement) {
//
// var nestedList = Pelement.childNodes[1];
//
// Pelement.style.fontWeight=Pelement... | true |
92d47d23b7f35acc339726d89245776ef406965d | JavaScript | sschneeberg/callbacks-timing-iterators | /hello.js | UTF-8 | 1,291 | 2.6875 | 3 | [] | no_license | function sayHello(name) {
let msg = 'Hello,' + name + '. How are you?';
return msg;
}
console.log(sayHello('Simone'));
function sayHello(name) {
let msg = 'Hello,' + name + '. How are you?';
return msg;
}
console.log(sayHello('Rome'));
function sayHello(name) {
let msg = 'Hello,' + name + '. How... | true |
60f267093038646b2bd772ee2b63d3287c3e44b9 | JavaScript | Laradejpl/sugarV10-2 | /swpp.js | UTF-8 | 1,442 | 2.78125 | 3 | [] | no_license | function like(){
$.ajax({
url:'like.php',
success:function(data)
{
}
});
};
$(document).ready(function(){
$(".buddy").on("swiperight",function(){
$(this).addClass('rotate-left').delay(700).fadeOut(1);
console.log("right");
document.... | true |
8404b80441284ad1de46d4e7647a6b30e11ad99b | JavaScript | bretthannigan/e-man | /public/main.js | UTF-8 | 925 | 2.9375 | 3 | [] | no_license | var update = document.getElementById('update');
var del = document.getElementById('delete');
update.addEventListener('click', function () {
fetch('edit', {
method: 'put',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
'full_name': 'Modified-Name!',
... | true |
1c0232e0b3923b90d382ae3077622ca0a5f1e600 | JavaScript | link89/oboe.js | /test/specs/lists.unit.spec.js | UTF-8 | 5,943 | 3.40625 | 3 | [
"BSD-2-Clause-Views"
] | permissive | import { cons, emptyList, foldR1, foldR, list, applyEach, without, listAsArray, all, map, head, tail, reverseList, arrayAsList } from '../../src/lists'
describe('Lists', function () {
'use strict'
var listA = cons('a', emptyList)
var listBA = cons('b', listA)
var listCBA = cons('c', listBA)
it('can use con... | true |
00504d27694ee25686f432e20dac73cc737d5005 | JavaScript | KiralyTamas/CodeBerryMarsExpedition | /js/main.js | UTF-8 | 545 | 2.796875 | 3 | [] | no_license | function uzemanyag() {
let atlagFogyasztas = document.getElementById("atlagFogyasztas").value;
let foldTavolsag = document.getElementById("foldTavolsag").value;
let tartaly = document.getElementById("tartaly").value;
let szuksegesUzemanyag = atlagFogyasztas / 100 * foldTavolsag;
let folosUzemanyag = tartaly -... | true |
6ecfdaa001319eac5d1aedf065cf19a27827b1e3 | JavaScript | beewhoo/oinker_v2 | /app/assets/javascripts/welcome.js | UTF-8 | 7,179 | 2.96875 | 3 | [] | no_license |
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM fully loaded and parsed");
// quantity of seats and participants
var plus = document.querySelector('.qtyplus');
var minus = document.querySelector('.qtyminus');
var quantity = document.querySelector('.qty');
if ... | true |
63dfa8f4a5ddaaf9bea3a90b20f2fd2e58eb35c6 | JavaScript | brainstormflash/trivia | /public/js/helpers.js | UTF-8 | 2,134 | 3.203125 | 3 | [] | no_license | function startTimer(duration, callback) {
var timer = duration, minutes, seconds;
repeat = setInterval(function () {
minutes = parseInt(timer / 60, 10);
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds :... | true |
62b455a75e41d73cde212de3e5c5338db3cfe9fd | JavaScript | iOSHaven/v4 | /plist.js | UTF-8 | 3,036 | 2.5625 | 3 | [] | no_license | const plist = require('simple-plist');
const fetch = require('node-fetch');
const commandLineArgs = require('command-line-args')
const https = require('https')
const exec = require('child-process-promise').exec
const fs = require('fs')
const options = commandLineArgs([
{ name: 'url', alias: 'u', type: String}
])
... | true |
46b322d3e009f224d0db5055c7594e3868bf5d63 | JavaScript | lGatl/Puissance4 | /p4/p4.js | UTF-8 | 5,208 | 2.625 | 3 | [] | no_license |
xi=1
bgi={}
jo={xi,bgi}
cd=true
changj(xi)
j=0
/*ANIMER LE JETON*/
/*Cree un tableau de 8*8 et le remplie de 0 */
function init(){
tab=[[],[],[],[],[],[],[],[]]
for (i=0;i<8;i++){for(j=0;j<8;j++){tab[i][j]=0}}
lig=0
}
function changj(x){
if (xi==1){xi=2}else{xi=1}
joueur(x)
initp($(".ti"))
}
function joueu... | true |
6b252d5b99449a2614884eb28dc9e8e55fa80e6a | JavaScript | emily-li/pig-game | /pig-game-0.0.1.js | UTF-8 | 3,249 | 3.234375 | 3 | [] | no_license | class PigGame {
constructor(cli) {
this.cli = cli;
this.pigNumber = 28;
this.pig = new Pig(cli);
this.state = new GameState();
}
run(userInput) {
this[this.state.state](userInput);
}
init() {
this.pig.introduce(this.pigNumber);
this.getNumPlayers();
}
getNumPlayers(userInput) {
if (userInpu... | true |
0ec1861ec87df22da2921b3e70da194dcd1af40a | JavaScript | manojown/javascript-pollyfill-example- | /stringify.js | UTF-8 | 837 | 3.546875 | 4 | [] | no_license | function stringify(value) {
let start = "";
if (typeof value === "object") {
let isLast = Object.keys(value).pop();
start += Array.isArray(value) ? "[" : "{";
for (let key in value) {
start += Array.isArray(value) ? "" : `"${key}":`;
let val = value[key];
start += `${stringify(val)}`;
if (key !== is... | true |
aec5e8942c0d310f681dfb40cff4901713d93acf | JavaScript | dbrizov/TelerikHomeworks | /JavaScript/JS Part 2/JS Advanced Functions HW/AdvancedFunctions/01. DOM Module/dom-module.js | UTF-8 | 3,280 | 3.53125 | 4 | [] | no_license | var domModule = (function () {
// Appends childElem to the parent/s with a given selector
function appendChild(childElem, parentSelector) {
var parents = document.querySelectorAll(parentSelector);
for (var i = 0; i < parent.length; i++) {
parent[i].appendChild(childElem.cloneNode(tr... | true |
a61259541689c1c3e00f625601f390dd23516e5c | JavaScript | xalmasin/JS-img-slider | /main.js | UTF-8 | 592 | 3.265625 | 3 | [] | no_license |
var images = ["https://source.unsplash.com/random/100x100",
"https://source.unsplash.com/user/erondu/100x100",
"https://source.unsplash.com/collection/190727/100x100"];
//Track the slide
var slide = 0;
var img = document.getElementById('img');
var slider = function(){
if(slide === 0){... | true |
b9980d9deec9294817f100c3d0776503f7a14ebe | JavaScript | Lt-Lowlander/join_practice | /app/javascript/react/containers/ChallengeIndexContainer.js | UTF-8 | 1,232 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router';
import ChallengeIndexTile from '../components/ChallengeIndexTile';
class ChallengeIndexContainer extends Component {
constructor(props) {
super(props)
this.state = {
challengesArray: []
}
}
componentDidMount(){
... | true |
95fbb87fe479561c3220ea69f9ee12dcd54275a7 | JavaScript | zhynidexiaoyuge/component-set | /src/store/module/theme.js | UTF-8 | 1,635 | 2.765625 | 3 | [] | no_license | // let name = "default";
// if (window.globalConfig.theme) {
// name = window.globalConfig.theme;
// }
// if (window.globalConfig.showChangeTheme) {
// const tmp = localStorage.getItem("theme");
// if (themeExist(tmp)) {
// name = tmp;
// }
// }
// function themeExist(name) {
// if (!name) return false;
... | true |
b8fddd5cc976c2ceebd0f9098c27d276f5ac1d9f | JavaScript | roylanceMichael/compling_570_shallowprocessing_washington | /homework1/hw1_dir/source/vocabulary.js | UTF-8 | 703 | 2.953125 | 3 | [] | no_license | function Vocabulary() {
this.frequencyHash = {};
}
Vocabulary.prototype = {
parseLine: function(line) {
if(line.trim() == "") {
return;
}
var tokens = line.trim().split(/\s+/);
for(var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if(this.frequencyHash[token] != undefined) {
this.... | true |
b48247ff8bd120c55cbcdd7d152851efda5af016 | JavaScript | Mariam1994/Periodic | /periodic/scripts/main.js | UTF-8 | 980 | 2.921875 | 3 | [
"MIT"
] | permissive | function main(){
document.querySelector( "#nav-toggle" ).addEventListener( "click", menu);
var popUp = false,
menuItem = document.getElementsByTagName('a'),
prev = menuItem[3];
$( prev ).toggleClass( "press" );
for(var i=0; i<5; i++)
menuItem[i].addEventLis... | true |
af538da9efac0ed258d0c0c42ef0987e0daaa057 | JavaScript | 56kz/345678 | /clase3java.js | UTF-8 | 3,235 | 4.0625 | 4 | [] | no_license | // var factorial = function (n) {
// if (n == 0) {
// return 1;
// } else {
// return n * factorial(n - 1);
// }
// };
//funcion de forma recursiva d iga si el numer es par o impar
// function is_even_recursion(number) {
// if (number < 0) {
// number.Math.abs(number);
// }
// if (number ===... | true |
92dd1d04624a90d07df813975ecf037f7ada4a01 | JavaScript | ElliotG98/MessagingApp | /app.js | UTF-8 | 1,156 | 2.78125 | 3 | [] | no_license | const express = require('express')
const socketio = require('socket.io')
const app = express()
//uses ejs as template engine - allows static template files reduces template into HTML file sent to the client
app.set('view engine', 'ejs')
app.use(express.static('public'))
//routing method - handle GET requests
app.get(... | true |
9921965822562e8af1d28c4d3e3bb7a1a3c0c729 | JavaScript | TrainingByPackt/Professional-Node.js | /Lesson05/exercises/01_read/streams-read.js | UTF-8 | 564 | 2.84375 | 3 | [
"MIT"
] | permissive | 'use strict';
const crypto = require('crypto');
const fs = require('fs');
const readStream = fs.createReadStream('./images/input/dilbert.jpg');
const hash = crypto.createHash('sha1');
const writeStream = fs.createWriteStream('./images/output/dilbert.jpg');
readStream
.on('readable', function() {
let chunk;
... | true |
7b2a5c648b8c755ef4634df6375833225f92bed1 | JavaScript | jskelcy/RegEx | /operations.js | UTF-8 | 1,360 | 3.125 | 3 | [] | no_license | function Or(re1, re2){
this.re1 = re1;
this.re2 = re2;
this.match = function(currentString){
var rest = this.re1.match(currentString);
if(rest !== undefined){
return rest;
}else{
return this.re2.match(currentString);
}
}
}
function Concat(re1, re2){
this.re1 = re1;
this.re2 = re2;
this.match = ... | true |
6422dc91f5207ab1e917a55afe0f6f7e5f6f90c3 | JavaScript | plumhly/vue_mall | /mall/Ex/ex.js | UTF-8 | 386 | 3.0625 | 3 | [] | no_license | // const a = {f: 'hillo', g: 'g'};
// const {f} = a;
// console.log(f);
// const a = 'plum';
// console.log({a});
// export var a = () => {};
exports.a = 1;
// export const b = 2;
// export const c = 3;
// export default {
// a: 1,
// }
// var poromiss = new Promise((resolve, inject) => {
// resolve(1);
// ... | true |
12c474016a804ae09b4011ad69edd43afd02f882 | JavaScript | Rahul-kumar828/Java--Script | /24_JS_Arrow_Function/app.js | UTF-8 | 2,075 | 4.6875 | 5 | [] | no_license | //1st how many way we can declare a function
/*
Function Type
1)Normal Function
2)Function Expression
3)Arrow Function
*/
let result='';
function printNumberNf(){
let msg='';
for(let i=0;i<=10; i++)
{
msg +=`${i} `;
}
return msg;
}
result=printNumberNf();
console.lo... | true |
407e54162800656b6cc90f21341401a46dda0f6b | JavaScript | baiyecha404/JWT-attack | /routes/index.js | UTF-8 | 1,804 | 2.5625 | 3 | [] | no_license | const express = require('express');
const path = require('path');
const jwt = require('jwt-simple');
const config = require('../config');
const router = express.Router();
const createToken = (username, creds) => {
const body = { "username": username, 'isAdmin': creds };
return jwt.encode(body, config.private... | true |
b8d966163382f47e4d21e35759622f4291150b89 | JavaScript | ethereumdegen/wallstreetbets-bot | /lib/util/ServerConfigurationHelper.js | UTF-8 | 579 | 2.828125 | 3 | [] | no_license |
module.exports = class ServerConfigurationHelper {
static getServerEnvMode(){
let mode = ServerConfigurationHelper.findArgParamStartingWith('--servermode=')
if(mode == 'production'){
return 'production'
}
if(mode == 'staging'){
return 'staging'
}
return 'development'
}
... | true |
1309e369230da304a56b94fc78ce0ed3b0afc1e8 | JavaScript | ml20101992/server_p1 | /scripts/overview.js | UTF-8 | 15,250 | 2.609375 | 3 | [] | no_license | var endpoint = "";
var success_function = null;
var current_page = 0;
parseLocation();
ajaxGetRequest(endpoint + current_page,success_function,fail);
function parseLocation(){
let location = window.location.href;
let selector = location.split('/');
selector = selector[selector.length - 2];
//console... | true |
ec54d77b7d899c21635cab68eceb903b9002173d | JavaScript | mkirvela/massikassi | /public/js/utils.js | UTF-8 | 3,060 | 2.609375 | 3 | [] | no_license | "use strict";
function _filterPayer(users, payer_id) {
return users.filter(function(user) {
return user.id == payer_id;
})
.map(function(u) {
return { id: u.id, name: u.name, payer: true };
});
}
function resolve(payments) {
var totalMoneySpent = payments.map(function(payment) ... | true |
e80a1c10ba3ddf7e7bdfbbe126c1d554b08cdd8c | JavaScript | Bunlong/react-papaparse | /docs/src/components/screens/indexes/RemoteFile.js | UTF-8 | 1,132 | 2.515625 | 3 | [
"MIT"
] | permissive | import React from 'react';
const RemoteFile = () => {
return (
<section id="remote-files">
<div className="grid-container narrow-grid">
<div className="grid-100">
<h4>Remote Files</h4>
<h5>"No — I mean, the file isn't on my computer."</h5>
<p>
Oh, wel... | true |
eb8f8b890f297c8aaffe884a244453687e822d69 | JavaScript | Vlad-Udovenko/Step-Project_Oop | /src/js/index.js | UTF-8 | 11,490 | 3.0625 | 3 | [] | no_license | // Get DOM Elements
const modal = document.querySelector('#visit-modal');
const modalBtn = document.querySelector('#modal-btn');
const closeBtn = document.querySelector('.close');
const createBtn = document.querySelector('.modal-footer button');
const mainBlock = document.querySelector('.main-block');
const clearAllBtn... | true |
64bc2bb4702aa8d9aed328f751ec7665292b7602 | JavaScript | Esteban-Rocha/codefights | /js/build/add/add.js | UTF-8 | 535 | 3.09375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-dco-1.1"
] | permissive | "use strict";
// @ts-check
/**
* JavaScript Add Challenge
* @author Esteban Rocha
* @link https://github.com/Esteban-Rocha
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.test = void 0;
/**
* @param input1 number
* @param input2 number
* @return boolean
*/
function add(in... | true |
245cc47fceb10277453b0a1103f5522f64669580 | JavaScript | luiscarlossf/how-to-contribute | /code/python/08-redirect-and-errors/app/static/validate.js | UTF-8 | 242 | 2.546875 | 3 | [] | no_license | function validate() {
uid = document.getElementById('userID');
pwd = document.getElementById("loginPassword");
cpwd = document.getElementById("loginPassword2");
if (cpwd.value != pwd.value) {
alert("Both Passwords must match!");
}
}
| true |
ed99b8fa148567f4d4d18339f9244012739867b9 | JavaScript | shawbena/react | /guid/src/display-data/app.js | UTF-8 | 7,205 | 3.578125 | 4 | [] | no_license | /*
展示数据
UI 要做的基本的东西就是展示一些数字。React 使得展示数据和数据更新时保持页面更新变得简单。
*/
/*
响应式的更新
在浏览器中打开 hello-react.html,在文本域中键入你的名子。注意 React UI 中的时间字符串——文本域中输入的任何值都会保留,即使你没有写任何代码管理这种行为。React 为你计算并做正确的事情。
除非需要 React 是不会操作 DOM 的。React 用内部的 mock DOM 执行比较并为你计算出效率最高的 DOM 修改。
这个组件的输入叫做 props —— "properties" 的简写。在 JSX 语法中,他们是作为属性传递的。在组件中你应该把这些... | true |
7624673f90aa7848a2243e7bc0832460d4659711 | JavaScript | GerardoSant/Finbook | /src/main/resources/public/javascript/websocketControl.js | UTF-8 | 488 | 2.828125 | 3 | [
"MIT"
] | permissive | function openWebSocket(textToSign){
var textToSign= textToSign;
console.log(textToSign);
let socket = new WebSocket("ws://localhost:8080/echo");
socket.onopen = function(e) {
};
socket.onmessage = function(e){
if(JSON.parse(e.data).id==textToSign){
submitLogInForm();
... | true |
d7aed622a7ba5259c5832da52d2000f116ea5782 | JavaScript | ahiguti/ase | /ase/misc/java/cltest.js | UTF-8 | 463 | 2.734375 | 3 | [
"MIT"
] | permissive |
var Comparable = Java["java.lang.Comparable"];
var JDate = Java["java.util.Date"];
var Arrays = Java["java.util.Arrays"];
var JClass = Java["java.lang.Class"];
var arr = JClass.NewArray(10);
arr[0] = JClass;
arr[1] = JDate;
arr[2] = Comparable;
print("A1: " + arr[0].getName());
print("A2: " + arr[1].getName());
print(... | true |
3daf9bd9f2eba5c3f19b5f57bfd049a00d961282 | JavaScript | LemonPrefect/sDelivr | /js/IsNight.js | UTF-8 | 1,716 | 2.6875 | 3 | [] | no_license | let timeNow = new Date();
let timestampNow = timeNow.getTime();
if($.cookie('sunrise') === undefined || $.cookie('sunset') === undefined || returnCitySN["cip"] !== $.cookie('ip')) {
console.log("IsNight? Run!");
var details = {};
details["TIME"] = parseInt(new Date().getTime() / 1000);
details["IP_ADDRE... | true |
4b4d8062b6954aa71092def3953508362e0f0a0e | JavaScript | MLT-NYC/leetcode | /plusOne.js | UTF-8 | 2,075 | 4.375 | 4 | [] | no_license | // Given a non-empty array of digits representing a non-negative integer, plus one to the integer.
// The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.
// You may assume the integer does not contain any leading zero, except the... | true |
6a0f0fa36c70c341fc8af91789d36df13955e780 | JavaScript | tnmnv/firstrep | /main5.js | UTF-8 | 193 | 2.71875 | 3 | [] | no_license | window.addEventListener('click', function(e) {
console.log(e.value);
let text = document.getElementById('text').value;
localStorage.setItem('key.value', text);
});
| true |
4636062d3d7b66ce13169d5a28ae91e091031556 | JavaScript | saiphanindra1010/RITO-PDF | /index.js | UTF-8 | 2,423 | 2.75 | 3 | [] | no_license | var primaryPdf = null
var mergePdf = null
// Uploaders
document.getElementById("fileUpload").onchange = event => fileUploader(event, loadPrimaryPdf);
document.getElementById("mergeFileUpload").onchange = event => fileUploader(event, loadMergePdf);
function fileUploader(event, onloadCallback) {
var input = event.t... | true |
f06417df4b520baac0e604168732953c4bcb15b6 | JavaScript | dwiyanscg/react | /bissmillah_belajar/src/App.js | UTF-8 | 1,943 | 2.78125 | 3 | [] | no_license | import React from 'react';
import logo from './logo.svg';
import './App.css';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
username: '',
age: null,
send: null,
errormessage: ''
};
}
myChangeHandler = (event) => {
let nam = event.tar... | true |
996d41289715ad104156a04335f054be3937b0f8 | JavaScript | mrgareth/MaquinaVirtual | /pweb2/SQLite/consulta.js | UTF-8 | 585 | 3.0625 | 3 | [] | no_license | function search(kind, term){
console.log(kind);
console.log(term);
var url = 'cgi-bin/consulta.py?kind='+kind+'?term'+term;
console.log(url);
loadDoc(url,render);
}
}
function render(data){
//Aqui leemos los datos y los devolveremos hacia el html
}
function loadDoc(url, cFunction){
var xhttp;
xhttp = new XML... | true |
dbb171816a57f9a266832daff7150b1035b148b7 | JavaScript | mariakang/clever-cat | /search-algorithms/search-algorithms.js | UTF-8 | 14,447 | 4.09375 | 4 | [] | no_license | /*
Search Algorithms
This application defines two search functions: linear search and binary
search. Each function takes two arguments: N and x, and will try to find x
in the range 1 to N (inclusive). If a match is found, the number of guesses
is returned, otherwise false is returned.
For a given test size N, this ap... | true |
77e7e685e9117326a0ec4a910c200ba9a6b16522 | JavaScript | rokydas/js-event | /callback.js | UTF-8 | 580 | 3.578125 | 4 | [] | no_license | function explainCallBack(name, age, task){
console.log("Hello ", name);
console.log("your age is ", age);
//console.log("your task is ", task);
task();
}
function washHand(){
console.log('Wash hand with soap');
}
function takeShower(){
console.log('Take Shower');
}
explainCallBack('Roky Das',... | true |
7f7c0ae5e4ba877ad3def88e447412436a0d6ba3 | JavaScript | eric-dowty/eric-dowty.github.io | /apps/rails-pub-sub-node-server/lib/chat.js | UTF-8 | 1,840 | 3.140625 | 3 | [
"MIT"
] | permissive | //initiate socket using const io from server
var socket = io();
//get DOM elements
var messages = document.getElementById('message-view');
var messageButton = document.getElementById('new-message-submit');
var nameButton = document.getElementById('name-submit');
var userName = 'Guest';
var userColor =... | true |
405ed7728f5fda48d6fed3c63f82d1a64de776bd | JavaScript | eddie0329/Study__React | /redux-practice/src/reducers.js | UTF-8 | 914 | 2.765625 | 3 | [] | no_license | import { ADD_TODO, COMPLETE_TODO } from "./action";
export function todos(previousState, action) {
if (previousState === undefined) {
return [];
}
if (action.type === ADD_TODO) {
return [...previousState, { text: action.text, completed: false }];
}
if (action.type === COMPLETE_TODO) {
const newSt... | true |
b3c255480db860aea9884c2f0b42ba4eea97a23e | JavaScript | andyemnem63/node_book | /Chapter05/10_async_parallel.js | UTF-8 | 381 | 2.609375 | 3 | [] | no_license | var async = require("async");
async.parallel({
numbers: function (callback) {
setTimeout(function () {
callback(null, [ 1, 2, 3 ]);
}, 1500);
},
strings: function (callback) {
setTimeout(function () {
callback(null, [ "a", "b", "c" ]);
}, 2000);
... | true |
581ba7c5f4f8f93a50f690c035266df23c902a3b | JavaScript | RadostinGerdzhikov/SOF-UNI-JS-APP-MODULE | /JS TECH MODULE SOFT UNI/06- DATA TYPES and VARIABLES-more EXERCUSIES/03-Cone.js | UTF-8 | 363 | 3.59375 | 4 | [] | no_license | 'use strict';
function cone(radius,height) {
let slantHeight = Math.sqrt(radius ** 2 + height ** 2);
let area = Math.PI * radius ** 2 + Math.PI * radius * slantHeight;
let volume = Math.PI * radius * radius * (height / 3);
console.log("volume = " + volume.toFixed(4));
console.log("area = "... | true |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 40