<script>
    function set(Key) {
        localStorage.setItem(Key, "demo");
    }
    function get(Key){
            localStorage.getItem(Key);
    }
</script>
上边是我的代码,但是我在输入set(1)的时候总是伴随undefined,但是却存入了,get(1)的时候也是一样出现undefined,但是取不到值,只有输入localStorage.getItem(1)的时候才能取到,有人知道为什么吗?求帮助

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你函数没返回值当然是undefined